Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a public ChangesByteSize conversion
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Warning |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 280d845a01
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| public static ByteSize Bits(this double input) => | ||
| ByteSize.FromBytes(input / ByteSize.BitsInByte); |
There was a problem hiding this comment.
Regenerate the current API reference
This adds a public ByteSizeExtensions.Bits(this double) overload, but the checked-in current API reference was not updated; website/docs/api/Humanizer.ByteSizeExtensions.md still lists only the existing bit overloads for byte/int/long/sbyte/short/uint/ushort at lines 16-22, so the generated docs and snapshot.ps1 -Version current -Check will be stale for this new API. Please regenerate and commit the current API reference with the new overload.
AGENTS.md reference: AGENTS.md:L50-L52
Useful? React with 👍 / 👎.
Summary
Adds a Bits(double) overload to ByteSizeExtensions so that a byte size can be created from a fractional number of bits, mirroring the existing Bytes(double) overload.
Motivation
Bytes(...) accepts double, but the symmetric Bits(...) accepted only integral types. This is an API inconsistency: with Bytes(double) you can build a size from fractional bytes (e.g. \2.5.Bytes()), but the same was not possible for bits.
Implementation
\\csharp
public static ByteSize Bits(this double input) =>
ByteSize.FromBytes(input / ByteSize.BitsInByte);
\\
The conversion goes through \FromBytes\ (not \FromBits(long)) to preserve the fractional part.
Tests
Added \DoubleBits\ test verifying \2.5.Bits().Bytes == 0.3125. All 103 tests in \ByteSizeExtensionsTests\ pass.