word-size

Read odd addresses, half words?

北慕城南 提交于 2019-12-12 13:36:15
问题 It's common knowledge that many CPU architectures (ARM, PPC) can not read odd addresses but will generate an exception if forced too, and yet others can, but do so slightly slower. (x86) But is there any CPU which can only address full 32 bit (or even larger!) words? I.e. it can not address 16 bit words? Perhaps amd64? I am trying to write a portable yet fast C malloc like allocator and want to align my memory accesses properly. Currently I am targeting ARM, i386 and amd64, and these I could

Specifying size of enum type in C

倖福魔咒の 提交于 2019-11-28 19:12:42
Already read through this related question , but was looking for something a little more specific. Is there a way to tell your compiler specifically how wide you want your enum to be? If so, how do you do it? I know how to specify it in C#; is it similarly done in C? Would it even be worth doing? When the enum value is passed to a function, will it be passed as an int -sized value regardless? Is there a way to tell your compiler specifically how wide you want your enum to be? In general case no. Not in standard C. Would it even be worth doing? It depends on the context. If you are talking

What are the sizes of tword, oword and yword operands?

江枫思渺然 提交于 2019-11-27 12:07:20
What are the sizes of tword , oword and yword operands, as used in the NASM / YASM manual ? And on a related note, is there a trick or underlying idea to these names? Is there a way by which bigger word sizes are given logical names? I know that while word sizes may differ between systems, a NASM word is 2 bytes, dword is double that (4 bytes), qword is a quad word (8 bytes), but... is tword a triple word (6 bytes)? And for oword and yword I can't even think of a plausible meaning. Note that it is probably an easy question, but I couldn't find an answer. In the NASM and YASM manuals these

Specifying size of enum type in C

廉价感情. 提交于 2019-11-27 12:02:33
问题 Already read through this related question, but was looking for something a little more specific. Is there a way to tell your compiler specifically how wide you want your enum to be? If so, how do you do it? I know how to specify it in C#; is it similarly done in C? Would it even be worth doing? When the enum value is passed to a function, will it be passed as an int -sized value regardless? 回答1: Is there a way to tell your compiler specifically how wide you want your enum to be? In general

Determine word size of my processor

丶灬走出姿态 提交于 2019-11-27 01:02:33
How do I determine the word size of my CPU? If I understand correct an int should be one word right? I'm not sure if I am correct. So should just printing sizeof(int) would be enough to determine the word size of my processor? Your assumption about sizeof(int) is untrue; see this . Since you must know the processor, OS and compiler at compilation time, the word size can be inferred using predefined architecture/OS/compiler macros provided by the compiler. However while on simpler and most RISC processors, word size, bus width, register size and memory organisation are often consistently one

What are the sizes of tword, oword and yword operands?

二次信任 提交于 2019-11-26 15:52:02
问题 What are the sizes of tword , oword and yword operands, as used in the NASM/YASM manual? And on a related note, is there a trick or underlying idea to these names? Is there a way by which bigger word sizes are given logical names? I know that while word sizes may differ between systems, a NASM word is 2 bytes, dword is double that (4 bytes), qword is a quad word (8 bytes), but... is tword a triple word (6 bytes)? And for oword and yword I can't even think of a plausible meaning. Note that it

Determine word size of my processor

你说的曾经没有我的故事 提交于 2019-11-26 09:33:34
问题 How do I determine the word size of my CPU? If I understand correct an int should be one word right? I\'m not sure if I am correct. So should just printing sizeof(int) would be enough to determine the word size of my processor? 回答1: Your assumption about sizeof(int) is untrue; see this. Since you must know the processor, OS and compiler at compilation time, the word size can be inferred using predefined architecture/OS/compiler macros provided by the compiler. However while on simpler and