u.h 1.6 KB

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