1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:07:35 +00:00

LibCrypto: Add the UnsignedBigInteger::Word alias

This makes it clearer which variables are operating on words instead
of directly operating on raw values.
This commit is contained in:
DexesTTP 2021-05-12 13:25:55 +02:00 committed by Linus Groh
parent 5963f6f9ff
commit f4e6f58cc6
5 changed files with 16 additions and 15 deletions

View file

@ -43,7 +43,7 @@ size_t UnsignedBigInteger::export_data(Bytes data, bool remove_leading_zeros) co
if (word_count > 0) {
ssize_t leading_zeros = -1;
if (remove_leading_zeros) {
u32 word = m_words[word_count - 1];
UnsignedBigInteger::Word word = m_words[word_count - 1];
for (size_t i = 0; i < sizeof(u32); i++) {
u8 byte = (u8)(word >> ((sizeof(u32) - i - 1) * 8));
data[out++] = byte;
@ -108,7 +108,7 @@ void UnsignedBigInteger::set_to_0()
m_cached_trimmed_length = {};
}
void UnsignedBigInteger::set_to(u32 other)
void UnsignedBigInteger::set_to(UnsignedBigInteger::Word other)
{
m_is_invalid = false;
m_words.resize_and_keep_capacity(1);