1
0

u.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #define nil ((void*)0)
  2. typedef unsigned short ushort;
  3. typedef unsigned char uchar;
  4. typedef unsigned long ulong;
  5. typedef unsigned int uint;
  6. typedef signed char schar;
  7. typedef long long vlong;
  8. typedef unsigned long long uvlong;
  9. typedef unsigned long long uintptr;
  10. typedef unsigned long usize;
  11. typedef uint Rune;
  12. typedef union FPdbleword FPdbleword;
  13. typedef uintptr jmp_buf[2];
  14. #define JMPBUFSP 0
  15. #define JMPBUFPC 1
  16. #define JMPBUFDPC 0
  17. typedef unsigned int mpdigit; /* for /sys/include/mp.h */
  18. typedef unsigned char u8int;
  19. typedef unsigned short u16int;
  20. typedef unsigned int u32int;
  21. typedef unsigned long long u64int;
  22. /* FCR (FCR31) */
  23. #define FPINEX (1<<7) /* enables */
  24. #define FPUNFL (1<<8)
  25. #define FPOVFL (1<<9)
  26. #define FPZDIV (1<<10)
  27. #define FPINVAL (1<<11)
  28. #define FPRNR (0<<0) /* rounding modes */
  29. #define FPRZ (1<<0)
  30. #define FPRPINF (2<<0)
  31. #define FPRNINF (3<<0)
  32. #define FPRMASK (3<<0)
  33. #define FPPEXT 0
  34. #define FPPSGL 0
  35. #define FPPDBL 0
  36. #define FPPMASK 0
  37. #define FPCOND (1<<23)
  38. /* FSR (also FCR31) */
  39. #define FPAINEX (1<<2) /* flags */
  40. #define FPAOVFL (1<<4)
  41. #define FPAUNFL (1<<3)
  42. #define FPAZDIV (1<<5)
  43. #define FPAINVAL (1<<6)
  44. union FPdbleword
  45. {
  46. double x;
  47. struct { /* big endian */
  48. ulong hi;
  49. ulong lo;
  50. };
  51. };
  52. /* stdarg */
  53. typedef char* va_list;
  54. #define va_start(list, start) list =\
  55. (sizeof(start) < 8?\
  56. (char*)((vlong*)&(start)+1):\
  57. (char*)(&(start)+1))
  58. #define va_end(list)\
  59. USED(list)
  60. #define va_arg(list, mode)\
  61. ((sizeof(mode) == 1)?\
  62. ((list += 8), (mode*)list)[-1]:\
  63. (sizeof(mode) == 2)?\
  64. ((list += 8), (mode*)list)[-1]:\
  65. (sizeof(mode) == 4)?\
  66. ((list += 8), (mode*)list)[-1]:\
  67. ((list += sizeof(mode)), (mode*)list)[-1])