本文整理匯總了TypeScript中neuroglancer/util/uint32array_builder.Uint32ArrayBuilder.appendArray方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Uint32ArrayBuilder.appendArray方法的具體用法?TypeScript Uint32ArrayBuilder.appendArray怎麽用?TypeScript Uint32ArrayBuilder.appendArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類neuroglancer/util/uint32array_builder.Uint32ArrayBuilder
的用法示例。
在下文中一共展示了Uint32ArrayBuilder.appendArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('basic cached 2-bit', () => {
const input = Uint32Array.of(
4, 3, 5, 4, //
1, 3, 3, 3, //
3, 1, 1, 1, //
5, 5, 3, 4 //
);
const volumeSize = [2, 2, 4];
const blockSize = [2, 2, 1];
const output = new Uint32ArrayBuilder();
output.appendArray([1, 2, 3]);
encodeChannel(output, blockSize, input, volumeSize);
expect(output.view)
.toEqual(Uint32Array.of(
1, 2, 3, //
9 | (2 << 24), 8, //
13 | (1 << 24), 12, //
13 | (1 << 24), 15, //
9 | (2 << 24), 16, //
0b01100001, 3, 4, 5, //
0b1110, 1, 3, //
0b00000001, //
0b01001010 //
));
});
示例2: it
it('size mismatch 1-bit', () => {
const input = Uint32Array.of(4, 0, 3, 0, 4, 0, 3, 0);
const inputStrides = [2, 4, 8];
const blockSize = [3, 2, 1];
const actualSize = [2, 2, 1];
const output = new Uint32ArrayBuilder();
output.appendArray([1, 2, 3]);
const cache = newCache();
let [encodedBits, tableOffset] =
encodeBlock(input, 0, inputStrides, blockSize, actualSize, 3, cache, output);
expect(encodedBits).toBe(1);
expect(tableOffset).toBe(1);
expect(output.view).toEqual(Uint32Array.of(1, 2, 3, 0b001001, 3, 0, 4, 0));
expect(Array.from(cache)).toEqual([['3,0,4,0', 1]]);
});