LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 let result = Object.create(PrimitiveType.prototype); | 51 let result = Object.create(PrimitiveType.prototype); |
52 result.viewTypes = [viewType]; | 52 result.viewTypes = [viewType]; |
53 result.byteLength = result.referenceLength = viewType.BYTES_PER_ELEMENT | 0; | 53 result.byteLength = result.referenceLength = viewType.BYTES_PER_ELEMENT | 0; |
54 | 54 |
55 let offsetShift = ilog2(result.byteLength) | 0; | 55 let offsetShift = ilog2(result.byteLength) | 0; |
56 result.createGetter = createGetter.bind(null, offsetShift); | 56 result.createGetter = createGetter.bind(null, offsetShift); |
57 result.createSetter = createSetter.bind(null, offsetShift); | 57 result.createSetter = createSetter.bind(null, offsetShift); |
58 // Note: this is a pretty inefficient way to zero out initial values. We | 58 // Note: this is a pretty inefficient way to zero out initial values. We |
59 // should consider using ArrayBuffer.fill(0) once it becomes available | 59 // should consider using ArrayBuffer.fill(0) once it becomes available |
60 // (https://bugzilla.mozilla.org/show_bug.cgi?id=730880). | 60 // (https://bugzilla.mozilla.org/show_bug.cgi?id=730880). |
61 result.cleanupValue = 0; | 61 result.initialValue = 0; |
62 result.Array = createArrayType.bind(null, result); | 62 result.Array = createArrayType.bind(null, result); |
63 Object.freeze(result); | 63 Object.freeze(result); |
64 return result; | 64 return result; |
65 } | 65 } |
66 | 66 |
67 exports.uint8 = exports.boolean = new PrimitiveType(Uint8Array); | 67 exports.uint8 = exports.boolean = new PrimitiveType(Uint8Array); |
68 exports.uint8clamped = new PrimitiveType(Uint8ClampedArray); | 68 exports.uint8clamped = new PrimitiveType(Uint8ClampedArray); |
69 exports.int8 = new PrimitiveType(Int8Array); | 69 exports.int8 = new PrimitiveType(Int8Array); |
70 exports.uint16 = new PrimitiveType(Uint16Array); | 70 exports.uint16 = new PrimitiveType(Uint16Array); |
71 exports.int16 = new PrimitiveType(Int16Array); | 71 exports.int16 = new PrimitiveType(Int16Array); |
72 exports.uint32 = new PrimitiveType(Uint32Array); | 72 exports.uint32 = new PrimitiveType(Uint32Array); |
73 exports.int32 = new PrimitiveType(Int32Array); | 73 exports.int32 = new PrimitiveType(Int32Array); |
74 exports.float32 = new PrimitiveType(Float32Array); | 74 exports.float32 = new PrimitiveType(Float32Array); |
75 exports.float64 = new PrimitiveType(Float64Array); | 75 exports.float64 = new PrimitiveType(Float64Array); |
LEFT | RIGHT |