Skip to content

Change isize to i32 #550

Merged
NSoiffer merged 2 commits intodaisy:mainfrom
moritz-gross:replace-isize-with-i32-in-chemistry
Apr 22, 2026
Merged

Change isize to i32 #550
NSoiffer merged 2 commits intodaisy:mainfrom
moritz-gross:replace-isize-with-i32-in-chemistry

Conversation

@moritz-gross
Copy link
Copy Markdown
Collaborator

@moritz-gross moritz-gross commented Apr 19, 2026

I was looking to learn Rust a bit more and saw that isize is used a lot in chemistry.rs, though I don't see why it shouldn't be a standard integer type like i32.
as I understand it, isize is primarily for pointers, ie platform dependent, which does not make sense for stuff like the likely_chem_superscript scoring function.

side note: I find the RegEx's like MULTIPLE_PLUS_OR_MINUS_OR_DOT very hard to read. What do you think about having some intermediate parts to have it in smaller chunks?

@moritz-gross moritz-gross requested a review from NSoiffer April 19, 2026 01:57
@NSoiffer
Copy link
Copy Markdown
Collaborator

That looks good. I suspect at some point, I started with a usize, realized I needed negative numbers, so just went with isize. i32 makes more sense. Efficiency-wise (memory/speed), it is irrelevant.

There are probably some usize usages that might make sense to be u32, but again, I'm pretty sure I used u32 in all the spots that matter.

@NSoiffer NSoiffer merged commit b1ec36b into daisy:main Apr 22, 2026
5 checks passed
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.

2 participants