At 09:36 PM 12/11/2011, Ralf A. Quint wrote: > >How can I get this code to do the Right Thing? Actually just realized that it's pretty easy, you just need to typecast properly all parts of the makeid macro:
#include <stdio.h> #include <string.h> typedef unsigned long zlong; // all parts of the macro need to be typecast to unsigned long, or operation on those parts will only be performed in 16 bits, // // despite the overall result type of the macro being defined as an unsigned long #define makeid(a,b,c,d) ((zlong) (((zlong)(a)<<24) + ((zlong)(b)<<16) + ((zlong)(c)<<8) + (zlong)(d))) #define ID_FORM makeid ('F','O','R','M') #define ID_IFZS makeid ('I','F','Z','S') #define ID_IFhd makeid ('I','F','h','d') #define ID_UMem makeid ('U','M','e','m') #define ID_CMem makeid ('C','M','e','m') #define ID_Stks makeid ('S','t','k','s') #define ID_ANNO makeid ('A','N','N','O') int main(void) { printf("sizeof(unsigned long) == %i\n", sizeof(unsigned long)); printf("sizeof(long long) == %i\n", sizeof(long long)); printf("ID_FORM == %lu\n", ID_FORM); printf("ID_IFZS == %lu\n", ID_IFZS); printf("ID_IFhd == %lu\n", ID_IFhd); printf("ID_UMem == %lu\n", ID_UMem); printf("ID_CMem == %lu\n", ID_CMem); printf("ID_Stks == %lu\n", ID_Stks); printf("ID_ANNO == %lu\n", ID_ANNO); return 0; } ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure _______________________________________________ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user