1 |
/* fat.h - Support for FAT filesystems interfaces. |
/* fat.h - Support for FAT filesystems interfaces. |
2 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
3 |
Written by Marcus Brinkmann. |
Written by Marcus Brinkmann. |
4 |
|
|
5 |
This file is part of the GNU Hurd. |
This file is part of the GNU Hurd. |
353 |
#if BYTE_ORDER == LITTLE_ENDIAN |
#if BYTE_ORDER == LITTLE_ENDIAN |
354 |
return *(unsigned int *)addr; |
return *(unsigned int *)addr; |
355 |
#elif BYTE_ORDER == BIG_ENDIAN |
#elif BYTE_ORDER == BIG_ENDIAN |
356 |
return *(unsigned int *)(addr + 4); |
return bswap_32 (*(unsigned int *) addr); |
357 |
#else |
#else |
358 |
return |
#error unknown byte order |
|
addr[0] | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24); |
|
359 |
#endif |
#endif |
360 |
} |
} |
361 |
|
|
365 |
#if BYTE_ORDER == LITTLE_ENDIAN |
#if BYTE_ORDER == LITTLE_ENDIAN |
366 |
return *(unsigned short *)addr; |
return *(unsigned short *)addr; |
367 |
#elif BYTE_ORDER == BIG_ENDIAN |
#elif BYTE_ORDER == BIG_ENDIAN |
368 |
return *(unsigned short *)addr + 2; |
return bswap_16 (*(unsigned int *) addr); |
369 |
#else |
#else |
370 |
return addr[0] | (addr[1] << 8); |
#error unknown byte order |
371 |
#endif |
#endif |
372 |
} |
} |
373 |
|
|
377 |
#if BYTE_ORDER == LITTLE_ENDIAN |
#if BYTE_ORDER == LITTLE_ENDIAN |
378 |
*(unsigned int *)addr = value; |
*(unsigned int *)addr = value; |
379 |
#elif BYTE_ORDER == BIG_ENDIAN |
#elif BYTE_ORDER == BIG_ENDIAN |
380 |
#error unknown byte order |
*(unsigned int *)addr = bswap_32 (value); |
381 |
#else |
#else |
382 |
addr[0] = value & 0xff; |
#error unknown byte order |
|
addr[1] = (value >> 8) & 0xff; |
|
|
addr[2] = (value >> 16) & 0xff; |
|
|
addr[3] = (value >> 24) & 0xff; |
|
383 |
#endif |
#endif |
384 |
} |
} |
385 |
|
|
389 |
#if BYTE_ORDER == LITTLE_ENDIAN |
#if BYTE_ORDER == LITTLE_ENDIAN |
390 |
*(unsigned short *)addr = value; |
*(unsigned short *)addr = value; |
391 |
#elif BYTE_ORDER == BIG_ENDIAN |
#elif BYTE_ORDER == BIG_ENDIAN |
392 |
#error unknown byte order |
*(unsigned int *)addr = bswap_16 (value); |
393 |
#else |
#else |
394 |
addr[0] = value & 0xff; |
#error unknown byte order |
|
addr[1] = (value >> 8) & 0xff; |
|
395 |
#endif |
#endif |
396 |
} |
} |
397 |
|
|