u.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #define nil ((void*)0)
  10. typedef unsigned short ushort;
  11. typedef unsigned char uchar;
  12. typedef unsigned long ulong;
  13. typedef unsigned int uint;
  14. typedef signed char schar;
  15. typedef long long vlong;
  16. typedef unsigned long long uvlong;
  17. typedef unsigned long uintptr;
  18. typedef unsigned long usize;
  19. typedef uint Rune;
  20. typedef union FPdbleword FPdbleword;
  21. typedef long jmp_buf[2];
  22. #define JMPBUFSP 0
  23. #define JMPBUFPC 1
  24. #define JMPBUFDPC 0
  25. typedef unsigned int mpdigit; /* for /sys/include/mp.h */
  26. typedef unsigned char u8int;
  27. typedef unsigned short u16int;
  28. typedef unsigned int u32int;
  29. typedef unsigned long long u64int;
  30. /* FCR (FCR31) */
  31. #define FPINEX (1<<7) /* enables */
  32. #define FPUNFL (1<<8)
  33. #define FPOVFL (1<<9)
  34. #define FPZDIV (1<<10)
  35. #define FPINVAL (1<<11)
  36. #define FPRNR (0<<0) /* rounding modes */
  37. #define FPRZ (1<<0)
  38. #define FPRPINF (2<<0)
  39. #define FPRNINF (3<<0)
  40. #define FPRMASK (3<<0)
  41. #define FPPEXT 0
  42. #define FPPSGL 0
  43. #define FPPDBL 0
  44. #define FPPMASK 0
  45. #define FPCOND (1<<23)
  46. /* FSR (also FCR31) */
  47. #define FPAINEX (1<<2) /* flags */
  48. #define FPAOVFL (1<<4)
  49. #define FPAUNFL (1<<3)
  50. #define FPAZDIV (1<<5)
  51. #define FPAINVAL (1<<6)
  52. union FPdbleword
  53. {
  54. double x;
  55. struct { /* big endian */
  56. uint32_t hi;
  57. uint32_t lo;
  58. };
  59. };
  60. /* stdarg */
  61. typedef char* va_list;
  62. #define va_start(list, start) list =\
  63. (sizeof(start) < 4?\
  64. (char*)((int*)&(start)+1):\
  65. (char*)(&(start)+1))
  66. #define va_end(list)\
  67. USED(list)
  68. #define va_arg(list, mode)\
  69. ((sizeof(mode) == 1)?\
  70. ((list += 4), (mode*)list)[-1]:\
  71. (sizeof(mode) == 2)?\
  72. ((list += 4), (mode*)list)[-1]:\
  73. ((list += sizeof(mode)), (mode*)list)[-1])