Skip to content

Commit

Permalink
fix: to slot number of strings and bytes that are > 32 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Aug 3, 2022
1 parent 2b1e3fb commit 8a5b90d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions lib/converterClasses2Storage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions src/ts/converterClasses2Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,11 @@ export const parseReferenceStorage = (
umlClass,
otherClasses
)
const slotSize = arrayItemSize > 16 ? 32 : arrayItemSize

const firstVariable: Variable = {
id: variableId++,
fromSlot: 0,
toSlot: Math.floor((slotSize - 1) / 32),
toSlot: Math.floor((arrayItemSize - 1) / 32),
byteSize: arrayItemSize,
byteOffset: 0,
type: baseType,
Expand All @@ -264,10 +263,10 @@ export const parseReferenceStorage = (
for (let i = 1; i < arrayLength; i++) {
variables.push({
id: variableId++,
fromSlot: Math.floor((i * slotSize) / 32),
toSlot: Math.floor(((i + 1) * slotSize - 1) / 32),
fromSlot: Math.floor((i * arrayItemSize) / 32),
toSlot: Math.floor(((i + 1) * arrayItemSize - 1) / 32),
byteSize: arrayItemSize,
byteOffset: (i * slotSize) % 32,
byteOffset: (i * arrayItemSize) % 32,
type: baseType,
dynamic,
noValue: false,
Expand Down

0 comments on commit 8a5b90d

Please sign in to comment.