Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 19x 19x 431310x 431304x 224640x 206664x 768x 768x 205896x 171430x 171429x 34466x 34465x 34465x 1x 1x 6x 1x 5x 1x 1x 4x 1x 1x 3x 2x 2x 1x 1x | import { uint16, uint32, uint8, bigUint64, int8, int32, int16, bigInt64 } from ".."; import { Ser } from "../types"; export const packInt: Ser<number> = (ctx, data) => { if (data >= 0) { if (data < 128) { uint8.ser(ctx, data); } else if (data < 256) { uint8.ser(ctx, 0xcc); uint8.ser(ctx, data); } else if (data < 65536) { uint8.ser(ctx, 0xcd); uint16.ser(ctx, data); } else if (data < 4294967296) { uint8.ser(ctx, 0xce); uint32.ser(ctx, data); } else { uint8.ser(ctx, 0xcf); bigUint64.ser(ctx, BigInt(data)); } } else { if (data >= -32) { int8.ser(ctx, data); } else if (data >= -128) { uint8.ser(ctx, 0xd0); int8.ser(ctx, data); } else if (data >= -32768) { uint8.ser(ctx, 0xd1); int16.ser(ctx, data); } else if (data >= -2147483648) { uint8.ser(ctx, 0xd2); int32.ser(ctx, data); } else { uint8.ser(ctx, 0xd3); bigInt64.ser(ctx, BigInt(data)); } } }; |