mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 09:04:37 +03:00
[i386] Use memory address constraints in __bswap_16s() and __bswap_64s()
Minimise code size by forcing the use of memory addresses for __bswap_16s() and __bswap_64s(). (__bswap_32s() cannot avoid loading the value into a register.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -19,7 +19,7 @@ __bswap_variable_16 ( uint16_t x ) {
|
|||||||
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
static inline __attribute__ (( always_inline )) void
|
||||||
__bswap_16s ( uint16_t *x ) {
|
__bswap_16s ( uint16_t *x ) {
|
||||||
__asm__ ( "rorw $8, %0" : "=g" ( *x ) : "0" ( *x ) );
|
__asm__ ( "rorw $8, %0" : "+m" ( *x ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline, const )) uint32_t
|
static inline __attribute__ (( always_inline, const )) uint32_t
|
||||||
@@ -63,9 +63,8 @@ __bswap_64s ( uint64_t *x ) {
|
|||||||
"xchgl %2,%1\n\t"
|
"xchgl %2,%1\n\t"
|
||||||
"bswapl %2\n\t"
|
"bswapl %2\n\t"
|
||||||
"movl %2,%0\n\t"
|
"movl %2,%0\n\t"
|
||||||
: "=g" ( dwords->low ), "=g" ( dwords->high ),
|
: "+m" ( dwords->low ), "+m" ( dwords->high ),
|
||||||
"=r" ( discard )
|
"=r" ( discard ) );
|
||||||
: "0" ( dwords->low ), "1" ( dwords->high ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _BITS_BYTESWAP_H */
|
#endif /* _BITS_BYTESWAP_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user