u.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 */
  24. #define FPINEX (1<<5)
  25. #define FPUNFL ((1<<4)|(1<<1))
  26. #define FPOVFL (1<<3)
  27. #define FPZDIV (1<<2)
  28. #define FPINVAL (1<<0)
  29. #define FPRNR (0<<10)
  30. #define FPRZ (3<<10)
  31. #define FPRPINF (2<<10)
  32. #define FPRNINF (1<<10)
  33. #define FPRMASK (3<<10)
  34. #define FPPEXT (3<<8)
  35. #define FPPSGL (0<<8)
  36. #define FPPDBL (2<<8)
  37. #define FPPMASK (3<<8)
  38. /* FSR */
  39. #define FPAINEX FPINEX
  40. #define FPAOVFL FPOVFL
  41. #define FPAUNFL FPUNFL
  42. #define FPAZDIV FPZDIV
  43. #define FPAINVAL FPINVAL
  44. union FPdbleword
  45. {
  46. double x;
  47. struct { /* little endian */
  48. ulong lo;
  49. ulong hi;
  50. };
  51. };
  52. typedef char* va_list;
  53. #define va_start(list, start) list =\
  54. (sizeof(start) < 4?\
  55. (char*)((int*)&(start)+1):\
  56. (char*)(&(start)+1))
  57. #define va_end(list)\
  58. USED(list)
  59. #define va_arg(list, mode)\
  60. ((sizeof(mode) == 1)?\
  61. ((list += 4), (mode*)list)[-4]:\
  62. (sizeof(mode) == 2)?\
  63. ((list += 4), (mode*)list)[-2]:\
  64. ((list += sizeof(mode)), (mode*)list)[-1])