diff options
| author | eeight <[email protected]> | 2022-02-10 16:46:18 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:18 +0300 |
| commit | 475c0a46f28166e83fd263badc7546377cddcabe (patch) | |
| tree | 39c5a49b8aaad78fe390b6f1f2886bdbda40f3e7 /library/cpp/packedtypes | |
| parent | a6e0145a095c7bb3770d6e07aee301de5c73f96e (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/packedtypes')
| -rw-r--r-- | library/cpp/packedtypes/longs_ut.cpp | 6 | ||||
| -rw-r--r-- | library/cpp/packedtypes/packed.h | 2 | ||||
| -rw-r--r-- | library/cpp/packedtypes/packedfloat.h | 30 |
3 files changed, 19 insertions, 19 deletions
diff --git a/library/cpp/packedtypes/longs_ut.cpp b/library/cpp/packedtypes/longs_ut.cpp index 8b06c934d2f..c2ee49b9e1d 100644 --- a/library/cpp/packedtypes/longs_ut.cpp +++ b/library/cpp/packedtypes/longs_ut.cpp @@ -5,7 +5,7 @@ #include <library/cpp/digest/old_crc/crc.h> #include <util/string/util.h> #include <util/stream/output.h> -#include <util/system/hi_lo.h> +#include <util/system/hi_lo.h> Y_UNIT_TEST_SUITE(TLongsTest) { Y_UNIT_TEST(TestLongs) { @@ -15,14 +15,14 @@ Y_UNIT_TEST_SUITE(TLongsTest) { TString s; s += Sprintf("x16=0x%x\n", (int)x16); - s += Sprintf("LO_8(x16)=0x%x HI_8(x16)=0x%x\n\n", (int)Lo8(x16), (int)Hi8(x16)); + s += Sprintf("LO_8(x16)=0x%x HI_8(x16)=0x%x\n\n", (int)Lo8(x16), (int)Hi8(x16)); char buf[100]; memset(buf, 0, 100); char* p = buf; int l = out_long(x64, buf); s += Sprintf("x64=0x%" PRIi64 "\n", x64); - s += Sprintf("LO_32(x64)=0x%" PRIu32 " HI_32(x64)=0x%" PRIu32 "\n", (ui32)Lo32(x64), (ui32)Hi32(x64)); + s += Sprintf("LO_32(x64)=0x%" PRIu32 " HI_32(x64)=0x%" PRIu32 "\n", (ui32)Lo32(x64), (ui32)Hi32(x64)); s += Sprintf("buf=%s, l=%d: ", buf, l); for (int i = 0; i < l; i++) { s += Sprintf("0x%02x ", buf[i]); diff --git a/library/cpp/packedtypes/packed.h b/library/cpp/packedtypes/packed.h index 88cff26ae2a..95d6dfdd476 100644 --- a/library/cpp/packedtypes/packed.h +++ b/library/cpp/packedtypes/packed.h @@ -65,7 +65,7 @@ struct TZCMemoryInput_traits { } }; -void Y_FORCE_INLINE PackUI32(IOutputStream& out, ui32 v) { +void Y_FORCE_INLINE PackUI32(IOutputStream& out, ui32 v) { char buf[sizeof(ui32)]; char* bufPtr = buf; size_t size; diff --git a/library/cpp/packedtypes/packedfloat.h b/library/cpp/packedtypes/packedfloat.h index f178912ed33..2d9f04064c0 100644 --- a/library/cpp/packedtypes/packedfloat.h +++ b/library/cpp/packedtypes/packedfloat.h @@ -1,8 +1,8 @@ #pragma once -#include <util/generic/cast.h> +#include <util/generic/cast.h> #include <util/generic/ylimits.h> -#include <util/system/hi_lo.h> +#include <util/system/hi_lo.h> #include <cmath> #include <cfloat> @@ -34,12 +34,12 @@ namespace NPackedFloat { self& operator=(float t) { assert(SIGNED == 1 || SIGNED == 0 && t >= 0.); - val = BitCast<ui32>(t) >> (15 + SIGNED); + val = BitCast<ui32>(t) >> (15 + SIGNED); return *this; } operator float() const { - return BitCast<float>((ui32)val << (15 + SIGNED)); + return BitCast<float>((ui32)val << (15 + SIGNED)); } static self New(float v) { @@ -81,15 +81,15 @@ namespace NPackedFloat { self& operator=(float t) { assert(SIGNED == 1 || SIGNED == 0 && t >= 0.); - ui16 hi16 = Hi16(t); + ui16 hi16 = Hi16(t); - ui8 sign = SIGNED ? Hi8(hi16) & 0x80 : 0; + ui8 sign = SIGNED ? Hi8(hi16) & 0x80 : 0; - hi16 <<= 1; + hi16 <<= 1; - ui8 fexp = Hi8(hi16); + ui8 fexp = Hi8(hi16); ui8 exp; - ui8 frac = (Lo8(hi16) & 0xf0) >> 4; + ui8 frac = (Lo8(hi16) & 0xf0) >> 4; if (fexp <= FMinExp) { exp = 0; @@ -106,25 +106,25 @@ namespace NPackedFloat { } operator float() const { - ui32 v = 0; + ui32 v = 0; - v |= SIGNED ? (val & 0x80) << 24 : 0; + v |= SIGNED ? (val & 0x80) << 24 : 0; ui8 frac = val & 0x0f; ui8 exp = val & MaxExp; if (exp) { - v |= ((exp >> 4) + FMinExp) << 23 | frac << 19; + v |= ((exp >> 4) + FMinExp) << 23 | frac << 19; } else if (DENORM && val & 0x0f) { while (!(frac & 0x10)) { frac <<= 1; ++exp; } - v |= (FMinExp - exp + 1) << 23 | (frac & 0x0f) << 19; + v |= (FMinExp - exp + 1) << 23 | (frac & 0x0f) << 19; } else - v |= 0; + v |= 0; - return BitCast<float>(v); + return BitCast<float>(v); } static self New(float v) { |
