OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function() { | 5 define("mojo/public/js/buffer", function() { |
6 var internal = mojoBindings.internal; | |
7 | 6 |
8 var kHostIsLittleEndian = (function () { | 7 var kHostIsLittleEndian = (function () { |
9 var endianArrayBuffer = new ArrayBuffer(2); | 8 var endianArrayBuffer = new ArrayBuffer(2); |
10 var endianUint8Array = new Uint8Array(endianArrayBuffer); | 9 var endianUint8Array = new Uint8Array(endianArrayBuffer); |
11 var endianUint16Array = new Uint16Array(endianArrayBuffer); | 10 var endianUint16Array = new Uint16Array(endianArrayBuffer); |
12 endianUint16Array[0] = 1; | 11 endianUint16Array[0] = 1; |
13 return endianUint8Array[0] == 1; | 12 return endianUint8Array[0] == 1; |
14 })(); | 13 })(); |
15 | 14 |
16 var kHighWordMultiplier = 0x100000000; | 15 var kHighWordMultiplier = 0x100000000; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 143 } |
145 } | 144 } |
146 | 145 |
147 Buffer.prototype.setFloat32 = function(offset, value) { | 146 Buffer.prototype.setFloat32 = function(offset, value) { |
148 this.dataView.setFloat32(offset, value, kHostIsLittleEndian); | 147 this.dataView.setFloat32(offset, value, kHostIsLittleEndian); |
149 } | 148 } |
150 Buffer.prototype.setFloat64 = function(offset, value) { | 149 Buffer.prototype.setFloat64 = function(offset, value) { |
151 this.dataView.setFloat64(offset, value, kHostIsLittleEndian); | 150 this.dataView.setFloat64(offset, value, kHostIsLittleEndian); |
152 } | 151 } |
153 | 152 |
154 internal.Buffer = Buffer; | 153 var exports = {}; |
155 })(); | 154 exports.Buffer = Buffer; |
| 155 return exports; |
| 156 }); |
OLD | NEW |