fake16.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* fake16.h -- fake the strict 16-bit memory model for test purposes
  2. This file is part of the UCL data compression library.
  3. Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
  4. All Rights Reserved.
  5. The UCL library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of
  8. the License, or (at your option) any later version.
  9. The UCL library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with the UCL library; see the file COPYING.
  15. If not, write to the Free Software Foundation, Inc.,
  16. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. Markus F.X.J. Oberhumer
  18. <markus@oberhumer.com>
  19. */
  20. /*
  21. * NOTE:
  22. * this file is *only* for testing the strict 16-bit memory model
  23. * on a 32-bit machine. Because things like integral promotion,
  24. * size_t and ptrdiff_t cannot be faked this is no real substitute
  25. * for testing under a real 16-bit system.
  26. *
  27. * See also <ucl/ucl16bit.h>
  28. *
  29. * Usage: #include "src/fake16.h" at the top of <ucl/uclconf.h>
  30. */
  31. #ifndef __UCLFAKE16BIT_H
  32. #define __UCLFAKE16BIT_H
  33. #ifdef __UCLCONF_H
  34. # error "include this file before uclconf.h"
  35. #endif
  36. #include <limits.h>
  37. #if (USHRT_MAX == 0xffff)
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. #define __UCL16BIT_H /* do not use <ucl/ucl16bit.h> */
  42. #define __UCL_STRICT_16BIT
  43. #define __UCL_FAKE_STRICT_16BIT
  44. #define UCL_99_UNSUPPORTED
  45. #define UCL_999_UNSUPPORTED
  46. typedef unsigned short ucl_uint;
  47. typedef short ucl_int;
  48. #define UCL_UINT_MAX USHRT_MAX
  49. #define UCL_INT_MAX SHRT_MAX
  50. #if 1
  51. #define __UCL_NO_UNALIGNED
  52. #define __UCL_NO_ALIGNED
  53. #endif
  54. #ifdef __cplusplus
  55. } /* extern "C" */
  56. #endif
  57. #endif
  58. #endif /* already included */