endian conversions
Standard data type conversions are fairly straight forward but how do
I handle user defined data types with bit fields and fields that cross
boundaries(word, half-word)? Eg/
struct Foo_t{
int f1:1;
int f2:3;
int f3:4;
int f4:24;
};
What needs to be swapped, if anything, for fields f1, f2, && f3 going
from one endian to the other?
Will f4 cause problems? I haven't done this in a while, and the last
time was in Ada95, but I could swear that fields that don't line up on
word and half-word boundaries gave me sigsegv's.
(Assume that this is running on a 32-bit machine.)
Thanks.
.
Relevant Pages
- Re: Freeing Algorithms
... On the other hand, int is simple, efficient, and handles very ... The data type int falls somewhere before the requirement of the user. ... To paraphrase the requirement (since requirements cannot be accurately expressed in English (or a programming language for the Mr. TDD!)), a data type that extended between negative and positive infinity is required to express the arrow of time. ... Assuming Java provided a data type that permitted an extension to infinity, then it would certainly make int look like hitherto "overkill". ... (comp.lang.java.programmer) - Re: User Input issue
... now we know that the int data type uses 4 bytes of memory. ... You wrote a moment ago that the programmer does not ... covered strings yet (I'm a college freshman in a Programming I/Novice ... (comp.lang.c) - RE: time_t size and year 2038 wrap
... > as long int. ... > redhat site for date 2038 and found very little current ... To bullet proof your code, you could declare a data type, ... or manipulations on your special versions of date-time. ... (RedHat) - Re: Working with Cash and uses of Typedef
... Which data type should I use instead? ... If you're tracking tenths of pennies, that same 16 bit int ... Abstraction is a powerful tool, and when done properly can make life ... (comp.lang.c) - User Input issue
... now we know that the int data type uses 4 bytes of memory. ... either a C-style string or C++ string and then use the stdlib header ... covered strings yet (I'm a college freshman in a Programming I/Novice ... (comp.lang.c) |
|