2

I'm porting C code where there are direct __asm__ calls from Linux to Windows. Those calls are not supported by the Visual Studio compiler so I'm looking for a Windows version of the following GCC call:

__asm__("bswapl %0" : "=r" (val) : "0" (val))

Could someone help me? Thanks!

Darkiwi
  • 227
  • 1
  • 4
  • 14
  • 3
    Take a look at [this piece of Microsoft Documentation](https://msdn.microsoft.com/en-us/library/a3140177.aspx) - Winodws has byte-swapping functions. You may also find [this](https://learn.microsoft.com/en-gb/cpp/assembler/inline/asm?view=vs-2017) helpful, it talks about `__asm` in Visual Studio. – Ankush Aug 29 '18 at 08:41

1 Answers1

3

Thanks to @Ankush, I used _byteswap_ulong and _byteswap_uint64, as documented here, and its seems to be working ok. Thanks!

Darkiwi
  • 227
  • 1
  • 4
  • 14