usuals.h 978 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 1995 Colin Plumb. All rights reserved.
  3. * For licensing and other legal details, see the file legal.c.
  4. *
  5. * usuals.h - Typedefs and #defines used widely.
  6. */
  7. #ifndef USUALS_H
  8. #define USUALS_H
  9. #include <limits.h>
  10. #if UCHAR_MAX == 0xff
  11. typedef unsigned char byte;
  12. typedef signed char int8;
  13. #else
  14. #error This machine has no 8-bit type
  15. #endif
  16. #if UINT_MAX == 0xffffu
  17. typedef unsigned word16;
  18. typedef int int16;
  19. #elif USHRT_MAX == 0xffffu
  20. typedef unsigned short word16;
  21. typedef short int16;
  22. #else
  23. #error This machine has no 16-bit type
  24. #endif
  25. #if UINT_MAX == 0xffffffffu
  26. typedef unsigned int word32;
  27. typedef int int32;
  28. #elif ULONG_MAX == 0xffffffffu
  29. typedef unsigned long word32;
  30. typedef long int32;
  31. #else
  32. #error This machine has no 32-bit type
  33. #endif
  34. #include <string.h> /* Prototype for memset */
  35. /*
  36. * Wipe sensitive data.
  37. * Note that this takes a structure, not a pointer to one!
  38. */
  39. #define wipe(x) memset(x, 0, sizeof(*(x)))
  40. #endif /* USUALS_H */