File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/// <reference path='../../../third_party/typings/browser.d.ts' />
22
3- // Byte-wise equality check of array buffers by comparison of each byte's
4- // value.
5- export function byteEquality ( b1 :ArrayBuffer , b2 :ArrayBuffer )
6- :boolean {
7- var a1 = new Uint8Array ( b1 ) ;
8- var a2 = new Uint8Array ( b2 ) ;
9- if ( a1 . byteLength !== a2 . byteLength ) return false ;
10- for ( var i :number = 0 ; i < a1 . byteLength ; ++ i ) {
11- if ( a1 [ i ] !== a2 [ i ] ) return false ;
12- }
13- return true ;
3+ // Returns true if b1 and b2 have exactly the same bytes.
4+ export function byteEquality ( b1 : ArrayBuffer , b2 : ArrayBuffer ) : boolean {
5+ // The Buffer instances share memory with their source ArrayBuffers.
6+ return new Buffer ( b1 ) . equals ( new Buffer ( b2 ) ) ;
147}
158
169// Concat |ArrayBuffer|s into a single ArrayBuffer. If size is given, then
You can’t perform that action at this time.
0 commit comments