OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 package fletch; | 5 package dartino; |
6 | 6 |
7 import java.nio.ByteBuffer; | 7 import java.nio.ByteBuffer; |
8 import java.nio.ByteOrder; | 8 import java.nio.ByteOrder; |
9 | 9 |
10 class Segment { | 10 class Segment { |
11 public Segment(byte[] memory) { | 11 public Segment(byte[] memory) { |
12 buffer = ByteBuffer.wrap(memory); | 12 buffer = ByteBuffer.wrap(memory); |
13 buffer.order(ByteOrder.LITTLE_ENDIAN); | 13 buffer.order(ByteOrder.LITTLE_ENDIAN); |
14 } | 14 } |
15 | 15 |
(...skipping 21 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 public long getUnsignedInt(int offset) { | 39 public long getUnsignedInt(int offset) { |
40 long result = (long)buffer.getInt(offset); | 40 long result = (long)buffer.getInt(offset); |
41 return (long)Math.abs(result); | 41 return (long)Math.abs(result); |
42 } | 42 } |
43 | 43 |
44 private ByteBuffer buffer; | 44 private ByteBuffer buffer; |
45 private MessageReader reader; | 45 private MessageReader reader; |
46 } | 46 } |
OLD | NEW |