- vocab_get: (addr, u) => {
- const word = String.fromCharCode.apply(
- null,
- new Uint16Array(wasmMem.buffer, addr, u >> 1)
- )
- const answer = dictionary[word.toUpperCase()]
- if (answer === undefined)
- return 0
- return answer
- },
- vocab_set: (addr, u, num) => {
- const word = String.fromCharCode.apply(
- null,
- new Uint16Array(wasmMem.buffer, addr, u >> 1)
- )
- dictionary[word.toUpperCase()] = num
- return 0
- },
- does_get: (u) => doesDictionary[u] || 0,
- does_set: (u, v) => doesDictionary[u] = v,
+ vocab_get: (addr, u) => dictionary[wasmString(addr, u).toUpperCase()] || 0,
+ vocab_set: (addr, u, v) => dictionary[wasmString(addr, u).toUpperCase()] = v,
+ does_get: (addr, u) => doesDictionary[wasmString(addr, u).toUpperCase()] || 0,
+ does_set: (addr, u, v) => doesDictionary[wasmString(addr, u).toUpperCase()] = v,