Skip to content
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

feat: atomic sum on v8 values #53

Merged
merged 4 commits into from
Dec 21, 2023
Merged

feat: atomic sum on v8 values #53

merged 4 commits into from
Dec 21, 2023

Conversation

losfair
Copy link
Member

@losfair losfair commented Dec 14, 2023

No description provided.

@johnspurlock-skymethod
Copy link
Contributor

How does this handle Number.NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY ?

@losfair
Copy link
Member Author

losfair commented Dec 14, 2023

How does this handle Number.NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY ?

Same as in JavaScript, because both V8 and Rust implement IEEE-754 floating point numbers.

Comment on lines 327 to 335
if matches!(operand, KvValue::U64(_)) {
mutate_le64(
tx,
&mutation.key,
"sum",
operand,
version,
|a, b| a.wrapping_add(b),
)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this code path be triggered from JS? By using Deno.AtomicOperation.mutate() method, and passing KvU64 value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@losfair losfair merged commit e6a50cf into main Dec 21, 2023
15 checks passed
@losfair losfair deleted the v8-atomic-ops branch December 21, 2023 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants