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 define("mojo/public/js/bindings/buffer", function() { | 5 define("mojo/public/js/buffer", function() { |
6 | 6 |
7 var kHostIsLittleEndian = (function () { | 7 var kHostIsLittleEndian = (function () { |
8 var endianArrayBuffer = new ArrayBuffer(2); | 8 var endianArrayBuffer = new ArrayBuffer(2); |
9 var endianUint8Array = new Uint8Array(endianArrayBuffer); | 9 var endianUint8Array = new Uint8Array(endianArrayBuffer); |
10 var endianUint16Array = new Uint16Array(endianArrayBuffer); | 10 var endianUint16Array = new Uint16Array(endianArrayBuffer); |
11 endianUint16Array[0] = 1; | 11 endianUint16Array[0] = 1; |
12 return endianUint8Array[0] == 1; | 12 return endianUint8Array[0] == 1; |
13 })(); | 13 })(); |
14 | 14 |
15 var kHighWordMultiplier = 0x100000000; | 15 var kHighWordMultiplier = 0x100000000; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 this.dataView.setFloat32(offset, value, kHostIsLittleEndian); | 147 this.dataView.setFloat32(offset, value, kHostIsLittleEndian); |
148 } | 148 } |
149 Buffer.prototype.setFloat64 = function(offset, value) { | 149 Buffer.prototype.setFloat64 = function(offset, value) { |
150 this.dataView.setFloat64(offset, value, kHostIsLittleEndian); | 150 this.dataView.setFloat64(offset, value, kHostIsLittleEndian); |
151 } | 151 } |
152 | 152 |
153 var exports = {}; | 153 var exports = {}; |
154 exports.Buffer = Buffer; | 154 exports.Buffer = Buffer; |
155 return exports; | 155 return exports; |
156 }); | 156 }); |
OLD | NEW |