fork download
  1. using System;
  2.  
  3. public class Test {
  4. public static uint SwapBytes(UInt32 x) {
  5. // swap adjacent 16-bit blocks
  6. x = (x >> 16) | (x << 16);
  7. // swap adjacent 8-bit blocks
  8. return ((x & 0xFF00FF00) >> 8) | ((x & 0x00FF00FF) << 8);
  9. }
  10.  
  11. static void Main() {
  12. var buffer = new byte[] { 33, 49, 0, 32, 0, 0, 0, 0, 2, 230, 69, 56, 0, 1, 125, 181, 99, 99, 136, 122, 92, 1, 99, 196, 231, 90, 205, 20, 75, 233, 5, 103 };
  13. var value = BitConverter.ToUInt32(buffer, 8);
  14. Console.WriteLine(SwapBytes(value));
  15. }
  16. }
Success #stdin #stdout 0s 131776KB
stdin
Standard input is empty
stdout
48645432