mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
LibCrypto: Add observers for the *byte* length of UnsignedBigInteger
When calling the export_data method, it's a bit of a hassle to remember that the caller's buffer needs to be the length() * Word.
This commit is contained in:
parent
139ff3552c
commit
008c89edde
1 changed files with 3 additions and 0 deletions
|
@ -99,6 +99,9 @@ public:
|
||||||
// The "trimmed length" is the number of words after trimming leading zeroed words
|
// The "trimmed length" is the number of words after trimming leading zeroed words
|
||||||
[[nodiscard]] size_t trimmed_length() const;
|
[[nodiscard]] size_t trimmed_length() const;
|
||||||
|
|
||||||
|
[[nodiscard]] size_t byte_length() const { return length() * sizeof(Word); }
|
||||||
|
[[nodiscard]] size_t trimmed_byte_length() const { return trimmed_length() * sizeof(Word); }
|
||||||
|
|
||||||
void clamp_to_trimmed_length();
|
void clamp_to_trimmed_length();
|
||||||
void resize_with_leading_zeros(size_t num_words);
|
void resize_with_leading_zeros(size_t num_words);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue