removed author details from comments for header file

This commit is contained in:
Krishna Vedala 2020-05-27 17:32:46 -04:00
parent 9965614174
commit 772e7fb789
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7

View File

@ -1,8 +1,8 @@
/** /**
* @file * @file
* @author Krishna Vedala * @brief Library to perform arithmatic operations on arbitrarily large
* @email krishna (dot) vedala (at) ieee (dot) org * numbers.
**/ */
#ifndef OTHERS_LARGE_NUMBER_H_ #ifndef OTHERS_LARGE_NUMBER_H_
#define OTHERS_LARGE_NUMBER_H_ #define OTHERS_LARGE_NUMBER_H_
@ -53,7 +53,8 @@ class large_number {
explicit large_number(char const *number_str) { explicit large_number(char const *number_str) {
for (size_t i = strlen(number_str); i > 0; i--) { for (size_t i = strlen(number_str); i > 0; i--) {
unsigned char a = number_str[i - 1] - '0'; unsigned char a = number_str[i - 1] - '0';
if (a >= 0 && a <= 9) _digits.push_back(a); if (a >= 0 && a <= 9)
_digits.push_back(a);
} }
} }
@ -152,9 +153,11 @@ class large_number {
**/ **/
friend bool operator==(large_number const &a, large_number const &b) { friend bool operator==(large_number const &a, large_number const &b) {
size_t N = a.num_digits(); size_t N = a.num_digits();
if (N != b.num_digits()) return false; if (N != b.num_digits())
return false;
for (size_t i = 0; i < N; i++) for (size_t i = 0; i < N; i++)
if (a[i] != b[i]) return false; if (a[i] != b[i])
return false;
return true; return true;
} }
@ -192,8 +195,10 @@ class large_number {
unsigned int carry = 0; unsigned int carry = 0;
size_t i; size_t i;
for (i = 0; i < max_L || carry != 0; i++) { for (i = 0; i < max_L || carry != 0; i++) {
if (i < b->num_digits()) carry += (*b)[i]; if (i < b->num_digits())
if (i < this->num_digits()) carry += (*this)[i]; carry += (*b)[i];
if (i < this->num_digits())
carry += (*this)[i];
if (i < this->num_digits()) if (i < this->num_digits())
(*this)[i] = carry % 10; (*this)[i] = carry % 10;
else else