mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-31 18:20:22 +08:00
nasmlib: Add _le helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
e74fd4b7b8
commit
2f038e9d5d
@ -249,6 +249,11 @@ void standard_extension(char *inname, char *outname, char *extension);
|
||||
|
||||
#if X86_MEMORY
|
||||
|
||||
static inline uint8_t char_le(uint8_t v) { return v; }
|
||||
static inline uint16_t short_le(uint16_t v) { return v; }
|
||||
static inline uint32_t long_le(uint32_t v) { return v; }
|
||||
static inline uint64_t dlong_le(uint64_t v) { return v; }
|
||||
|
||||
#define WRITECHAR(p,v) \
|
||||
do { \
|
||||
*(uint8_t *)(p) = (v); \
|
||||
@ -282,6 +287,32 @@ void standard_extension(char *inname, char *outname, char *extension);
|
||||
|
||||
#else /* !X86_MEMORY */
|
||||
|
||||
static inline uint8_t char_le(uint8_t v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline uint16_t short_le(uint16_t v)
|
||||
{
|
||||
return (v << 8) | (v >> 8);
|
||||
}
|
||||
|
||||
static inline uint32_t long_le(uint32_t v)
|
||||
{
|
||||
v = ((v << 8) & 0xff00ff00 ) |
|
||||
((v >> 8) & 0x00ff00ff);
|
||||
return (v << 16) | (v >> 16);
|
||||
}
|
||||
|
||||
static inline uint64_t dlong_le(uint64_t v)
|
||||
{
|
||||
v = ((v << 8) & 0xff00ff00ff00ff00ull) |
|
||||
((v >> 8) & 0x00ff00ff00ff00ffull);
|
||||
v = ((v << 16) & 0xffff0000ffff0000ull) |
|
||||
((v >> 16) & 0x0000ffff0000ffffull);
|
||||
return (v << 32) | (v >> 32);
|
||||
}
|
||||
|
||||
#define WRITECHAR(p,v) \
|
||||
do { \
|
||||
uint8_t *_wc_p = (uint8_t *)(p); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user