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
Notes: sideshowbarker 2024-07-18 18:13:48 +09:00
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);