Created
January 30, 2026 05:15
-
-
Save usrnatc/b2a126c007d240a497bfe468e3a1027b to your computer and use it in GitHub Desktop.
16-, 32-, and 64-bit byteswap implementation for win32 with no CRT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; win32_bswap.asm | |
| ;; | |
| ;; This is intended as a replacement to the MS _byteswap_xxxx functions | |
| ;; This is unneeded if not build with /NODEFAULTLIB | |
| ;; | |
| .code | |
| _byteswap_ulong proc | |
| bswap ecx | |
| mov eax, ecx | |
| ret | |
| _byteswap_ulong endp | |
| _byteswap_uint64 proc | |
| bswap rcx | |
| mov rax, rcx | |
| ret | |
| _byteswap_uint64 endp | |
| _byteswap_ushort proc | |
| xchg cl, ch | |
| movzx eax, cx | |
| ret | |
| _byteswap_ushort endp | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment