NASM 2.03rc7
[nasm/avx512.git] / wsaa.h
blob63f8335d7cbdec0dd75556ab02462e41e6e1a857
1 #ifndef NASM_WSAA_H
2 #define NASM_WSAA_H
4 #include "compiler.h"
5 #include "nasmlib.h"
7 #if X86_MEMORY
9 #define WSAACHAR(s,p,v) \
10 do { \
11 *(uint8_t *)(p) = (v); \
12 saa_wbytes(s, p, 1); \
13 } while (0)
15 #define WSAASHORT(s,p,v) \
16 do { \
17 *(uint16_t *)(p) = (v); \
18 saa_wbytes(s, p, 2); \
19 } while (0)
21 #define WSAALONG(s,p,v) \
22 do { \
23 *(uint32_t *)(p) = (v); \
24 saa_wbytes(s, p, 4); \
25 } while (0)
27 #define WSAADLONG(s,p,v) \
28 do { \
29 *(uint64_t *)(p) = (v); \
30 saa_wbytes(s, p, 8); \
31 } while (0)
33 #else /* !X86_MEMORY */
35 #define WSAACHAR(s,p,v) \
36 do { \
37 *(uint8_t *)(p) = (v); \
38 saa_wbytes(s, p, 1); \
39 } while (0)
41 #define WSAASHORT(s,p,v) \
42 do { \
43 uint16_t _wss_v = (v); \
44 uint8_t *_wss_p = (uint8_t *)(p); \
45 _wss_p[0] = _wss_v; \
46 _wss_p[1] = _wss_v >> 8; \
47 saa_wbytes(s, _wss_p, 2); \
48 } while (0)
50 #define WSAALONG(s,p,v) \
51 do { \
52 uint32_t _wsl_v = (v); \
53 uint8_t *_wsl_p = (uint8_t *)(p); \
54 _wsl_p[0] = _wsl_v; \
55 _wsl_p[1] = _wsl_v >> 8; \
56 _wsl_p[2] = _wsl_v >> 16; \
57 _wsl_p[3] = _wsl_v >> 24; \
58 saa_wbytes(s, _wsl_p, 4); \
59 } while (0)
61 #define WSAADLONG(s,p,v) \
62 do { \
63 uint64_t _wsq_v = (v); \
64 uint8_t *_wsq_p = (uint8_t *)(p); \
65 _wsq_p[0] = _wsq_v; \
66 _wsq_p[1] = _wsq_v >> 8; \
67 _wsq_p[2] = _wsq_v >> 16; \
68 _wsq_p[3] = _wsq_v >> 24; \
69 _wsq_p[4] = _wsq_v >> 32; \
70 _wsq_p[5] = _wsq_v >> 40; \
71 _wsq_p[6] = _wsq_v >> 48; \
72 _wsq_p[7] = _wsq_v >> 56; \
73 saa_wbytes(s, _wsq_p, 8); \
74 } while (0)
76 #endif
78 #endif /* NASM_WSAA_H */