MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / parseOperand

Function parseOperand

libraries/p5.js:2984–3022  ·  view source on GitHub ↗
(parser, b0)

Source from the content-addressed store, hash-verified

2982
2983// Parse a `CFF` DICT operand.
2984function parseOperand(parser, b0) {
2985 var b1;
2986 var b2;
2987 var b3;
2988 var b4;
2989 if (b0 === 28) {
2990 b1 = parser.parseByte();
2991 b2 = parser.parseByte();
2992 return b1 << 8 | b2;
2993 }
2994
2995 if (b0 === 29) {
2996 b1 = parser.parseByte();
2997 b2 = parser.parseByte();
2998 b3 = parser.parseByte();
2999 b4 = parser.parseByte();
3000 return b1 << 24 | b2 << 16 | b3 << 8 | b4;
3001 }
3002
3003 if (b0 === 30) {
3004 return parseFloatOperand(parser);
3005 }
3006
3007 if (b0 >= 32 && b0 <= 246) {
3008 return b0 - 139;
3009 }
3010
3011 if (b0 >= 247 && b0 <= 250) {
3012 b1 = parser.parseByte();
3013 return (b0 - 247) * 256 + b1 + 108;
3014 }
3015
3016 if (b0 >= 251 && b0 <= 254) {
3017 b1 = parser.parseByte();
3018 return -(b0 - 251) * 256 - b1 - 108;
3019 }
3020
3021 throw new Error('Invalid b0 ' + b0);
3022}
3023
3024// Convert the entries returned by `parseDict` to a proper dictionary.
3025// If a value is a list of one, it is unpacked.

Callers 1

parseCFFDictFunction · 0.85

Calls 1

parseFloatOperandFunction · 0.85

Tested by

no test coverage detected