Skip to content

Encapsulate invalidBase32, avoid 0xFF magic number#13685

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:hash-sentinal-encapsulation
Aug 4, 2025
Merged

Encapsulate invalidBase32, avoid 0xFF magic number#13685
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:hash-sentinal-encapsulation

Conversation

@Ericson2314
Copy link
Member

Motivation

This keeps things fast by making the function inline, but also prevents people from having to know about the 0xFF implementation detail directly, instead making one go through a std::optional (which could be fused away with a sufficiently smart compiler).

Additionally, the base "nix32" implementation is moved to its own header file pair, as it is logically distinct and prior to the Hash data type. It would probably be nice to do this with all the hash format implementations.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Ericson2314 Ericson2314 requested a review from edolstra as a code owner August 4, 2025 19:14
This keeps things fast by making the function inline, but also prevents
people from having to know about the `0xFF` implementation detail
directly, instead making one go through a `std::optional` (which could be
fused away with a sufficiently smart compiler).

Additionally, the base "nix32" implementation is moved to its own header
file pair, as it is logically distinct and prior to the `Hash` data
type. It would probably be nice to do this with all the hash format
implementations.
@Ericson2314 Ericson2314 force-pushed the hash-sentinal-encapsulation branch from 4dd20f6 to 23c87d8 Compare August 4, 2025 19:32
Comment on lines +30 to +31
else
return digit;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
else
return digit;
return digit;

@Ericson2314 Ericson2314 enabled auto-merge August 4, 2025 19:41
@Ericson2314 Ericson2314 merged commit 0889960 into NixOS:master Aug 4, 2025
14 checks passed
@Ericson2314 Ericson2314 deleted the hash-sentinal-encapsulation branch August 4, 2025 20:04
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