c - On a 16-bit microprocessor, should I be using datatype short instead of int? -


i've read using short vs int creating inefficiency compiler in needs use int datatype regardless because of c integer promotion. true 16-bit microprocessors?

another question: if have array of 1s , 0s, efficient use uint8_t or unsigned char in 16-bit microprocessor? or there still issue being converted int..

please me clear muddy issue in mind. thanks!

on blackfin not simple answer whether 32 or 16 bit types generate higher performance since supports 16, 32 , 64-bit instructions, , has 2 16 bit macs. depend on operations, suggest trust compiler optimiser make such decisions, knows more processor's instruction timing , scheduling care to.

that said may in compiler int , short same size in case. consult documentation, ot test sizeof , or in limits.h header numeric ranges infer widths or various types.

if want restrict data type size use stdint.h types such int16_t.

stdint.h defines fastest minimum-width integer types such int_fast16_t, guarantee minimum width, use larger type if faster on target. portable way of solving problem, relies on implementer have made decisions appropriate types use. on architectures makes little or no difference, on risc , dsp architectures may not case. may not case particular size fastest in circumstances, , true in case of blackfin.

in cases (where large amounts of data transferred external memory), fastest size 1 matches data bus width.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -