flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [30/51] [abbrv] flink git commit: [hotfix] Determing native byte order via ByteOrder.nativeOrder()
Date Thu, 27 Aug 2015 11:25:47 GMT
[hotfix] Determing native byte order via ByteOrder.nativeOrder()

This closes #1065


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/08500f26
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/08500f26
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/08500f26

Branch: refs/heads/master
Commit: 08500f262234445113c6074d3ba29ffb68f1aa33
Parents: 844e0b2
Author: Suminda Dharmasena <sirinath1978m@gmail.com>
Authored: Thu Aug 27 11:41:57 2015 +0530
Committer: Stephan Ewen <sewen@apache.org>
Committed: Thu Aug 27 12:40:38 2015 +0200

----------------------------------------------------------------------
 .../org/apache/flink/core/memory/MemoryUtils.java    | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/08500f26/flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java b/flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java
index 0ae12c7..c1f626f 100644
--- a/flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java
+++ b/flink-core/src/main/java/org/apache/flink/core/memory/MemoryUtils.java
@@ -57,20 +57,7 @@ public class MemoryUtils {
 	
 	@SuppressWarnings("restriction")
 	private static ByteOrder getByteOrder() {
-		final byte[] bytes = new byte[8];
-		final long value = 0x12345678900abdefL;
-		UNSAFE.putLong(bytes, (long) UNSAFE.arrayBaseOffset(byte[].class), value);
-		
-		final int lower = bytes[0] & 0xff;
-		final int higher = bytes[7] & 0xff;
-		
-		if (lower == 0x12 && higher == 0xef) {
-			return ByteOrder.BIG_ENDIAN;
-		} else if (lower == 0xef && higher == 0x12) {
-			return ByteOrder.LITTLE_ENDIAN;
-		} else {
-			throw new RuntimeException("Unrecognized byte order.");
-		}
+		return ByteOrder.nativeOrder();
 	}
 	
 	


Mime
View raw message