Browse Source

update: fully qualified in std namespace

master
Dnomd343 6 months ago
parent
commit
54d51e184a
  1. 6
      src/impl/sine.inc
  2. 6
      src/impl/wrapper.cc

6
src/impl/sine.inc

@ -35,13 +35,13 @@ constexpr double sin_core(double x) {
/// Calculate the sin(x) value in radians. /// Calculate the sin(x) value in radians.
constexpr double sin(double x) { constexpr double sin(double x) {
x = std::fmod(x, 2 * PI); // -2PI < x < 2PI x = ::std::fmod(x, 2 * PI); // -2PI < x < 2PI
if (std::abs(x) > PI) { if (::std::abs(x) > PI) {
x -= ((x > 0) ? 2 : -2) * PI; // -PI < x < PI x -= ((x > 0) ? 2 : -2) * PI; // -PI < x < PI
} }
if (std::abs(x) > PI / 2) { if (::std::abs(x) > PI / 2) {
x = ((x > 0) ? 1 : -1) * PI - x; // -PI / 2 < x < PI / 2 x = ((x > 0) ? 1 : -1) * PI - x; // -PI / 2 < x < PI / 2
} }
return sin_core(x); // closer to 0 for better accuracy return sin_core(x); // closer to 0 for better accuracy

6
src/impl/wrapper.cc

@ -18,13 +18,13 @@ std::string MD5::Digest() const {
MD5& MD5::Update(const void *data, uint64_t len) { MD5& MD5::Update(const void *data, uint64_t len) {
if (buffer_size_ != 0) { if (buffer_size_ != 0) {
if (buffer_size_ + len < 64) { // buffer not filled if (buffer_size_ + len < 64) { // buffer not filled
std::memcpy(buffer_ + buffer_size_, data, len); ::std::memcpy(buffer_ + buffer_size_, data, len);
buffer_size_ += len; buffer_size_ += len;
return *this; // save into buffer and return return *this; // save into buffer and return
} }
auto size = 64 - buffer_size_; auto size = 64 - buffer_size_;
std::memcpy(buffer_ + buffer_size_, data, size); ::std::memcpy(buffer_ + buffer_size_, data, size);
UpdateImpl(buffer_, 64); // fill and update with buffer UpdateImpl(buffer_, 64); // fill and update with buffer
data = static_cast<const char*>(data) + size; data = static_cast<const char*>(data) + size;
buffer_size_ = 0; buffer_size_ = 0;
@ -34,7 +34,7 @@ MD5& MD5::Update(const void *data, uint64_t len) {
data = UpdateImpl(data, len); data = UpdateImpl(data, len);
len &= 0b111111; // len -> [0, 64) len &= 0b111111; // len -> [0, 64)
if (len != 0) { if (len != 0) {
std::memcpy(buffer_, data, len); // save remain data into buffer ::std::memcpy(buffer_, data, len); // save remain data into buffer
buffer_size_ = len; buffer_size_ = len;
} }
return *this; return *this;

Loading…
Cancel
Save