Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2017-05-05 20:31:58 +0300
committerGitHub <noreply@github.com>2017-05-05 20:31:58 +0300
commitce7dc78c20bc73b4a07bb2b51ba7d9745791b5c2 (patch)
treeb15b87a791db1fa8697f0800e4134722b22ecadb /src/Native/Common
parent89e02a32d4835fc6caef2922333609c9d9cc34ba (diff)
Implement Guid.NewGuid on Unix (#3531)
Diffstat (limited to 'src/Native/Common')
-rw-r--r--src/Native/Common/pal_endian.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Native/Common/pal_endian.h b/src/Native/Common/pal_endian.h
new file mode 100644
index 000000000..69315acc6
--- /dev/null
+++ b/src/Native/Common/pal_endian.h
@@ -0,0 +1,20 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#pragma once
+
+#include <inttypes.h>
+
+inline uint16_t SWAP16(uint16_t x)
+{
+ return (x >> 8) | (x << 8);
+}
+
+inline uint32_t SWAP32(uint32_t x)
+{
+ return (x >> 24) |
+ ((x >> 8) & 0x0000FF00L) |
+ ((x & 0x0000FF00L) << 8) |
+ (x << 24);
+}