-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Cleanup offset constants in String
module
#2237
base: main
Are you sure you want to change the base?
chore: Cleanup offset constants in String
module
#2237
Conversation
* @returns `true` if the byte is a leading byte, `false` otherwise | ||
*/ | ||
@unsafe | ||
provide let isLeadingByte = byte => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intended to be used somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used in string.gr
so its just a tiny bit of cleanup I noticed while looking for constants and decided to address in this pr.
WasmI32.store(arr + arrIdx, str, 8n) | ||
arrIdx += 4n | ||
Memory.copy(str + _STR_DATA_OFFSET, last, strSize) | ||
WasmI32.store(arr + _ARRAY_DATA_OFFSET, str, arrIdx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you flip these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I flipped them as I figured we should be offsetting into the array for the item rather than moving the pointer, it doesn't really make a difference though.
let str = " argument must be non-negative" | ||
throw Exception.InvalidArgument(name ++ str) | ||
use WasmI32.{ (<) } | ||
let _num = convSimpleNumber(num, name ++ " argument must be an integer") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note is that in the nominal case this is now less efficient due to needing to do this string allocation + concat every time rather than only in the bad case
This pr works towards #703 I started with the
string
module, I also changed a few other modules to use the commonoffsets
module for their offsets, if we are good with the approach I am taking to this I will do the same to the other modules but I figure that might be best todo in a separate pr.Notes:
Offsets
module for consistency sake.