Skip to content

Conversation

@theirix
Copy link
Contributor

@theirix theirix commented Dec 9, 2025

Which issue does this PR close?

Rationale for this change

i256 doesn't implement some numeric traits. It'd be good to have it supported alongside other standard types.

What changes are included in this PR?

  • Trait implementations (checked ops, Num, One, Zero) using already written methods
  • Unit tests

Not all traits are implemented (checked shl/shr, pow is not here yet). The main point of this PR is to provide a starting implementation.

Are these changes tested?

Tested via new unit test

Are there any user-facing changes?

Only new trait implementation.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Dec 9, 2025
@theirix theirix marked this pull request as ready for review December 9, 2025 22:46
Some(i256::from_i128(5))
);

assert_eq!(
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for these tests -- can we also test the others (checked_sub, for example)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sure, let me add them for completeness

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @theirix - this looks good to me

@alamb alamb merged commit c6cc7f8 into apache:main Dec 13, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arrow-buffer: implement num-traits for i256

2 participants