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 | 8x 4x 8x 20x 5x 15x 5x 10x 8x 20x 5x 15x 5x 10x 5x 5x 8x 16x 16x 16x | import type { EngineFieldCType } from "store/features/engine/engineState"; export const is16BitCType = (cType: EngineFieldCType): boolean => { return cType === "WORD" || cType === "UWORD"; }; export const minForCType = (cType: EngineFieldCType): number => { if (cType === "WORD") { return -32768; } if (cType === "BYTE") { return -128; } return 0; }; export const maxForCType = (cType: EngineFieldCType): number => { if (cType === "UWORD") { return 65535; } if (cType === "WORD") { return 32767; } if (cType === "BYTE") { return 127; } return 255; }; export const clampToCType = ( value: number, cType: EngineFieldCType ): number => { const min = minForCType(cType); const max = maxForCType(cType); return Math.max(min, Math.min(max, value)); }; |