From ec38e539412ed91c870219856b45f2874235d63c Mon Sep 17 00:00:00 2001 From: Maxim Pimenov Date: Tue, 14 Jul 2015 13:17:32 +0300 Subject: [PATCH] [omim] [coding] Remove bit_shift.hpp. --- coding/bit_shift.hpp | 26 ------------------- coding/coding.pro | 1 - coding/coding_tests/bit_shift_test.cpp | 25 ------------------ coding/coding_tests/coding_tests.pro | 1 - xcode/coding/coding.xcodeproj/project.pbxproj | 4 --- 5 files changed, 57 deletions(-) delete mode 100644 coding/bit_shift.hpp delete mode 100644 coding/coding_tests/bit_shift_test.cpp diff --git a/coding/bit_shift.hpp b/coding/bit_shift.hpp deleted file mode 100644 index 7d90a547d0..0000000000 --- a/coding/bit_shift.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "std/limits.hpp" - -namespace bits -{ - template - struct bits_of - { - enum - { - value = sizeof(T) * CHAR_BIT - }; - }; - - template - T ror(T val, unsigned int n) - { - enum - { - bits = bits_of::value - }; - n = n % bits; - return (val >> n) | (val << (bits - n)); - } -} diff --git a/coding/coding.pro b/coding/coding.pro index 4013ec2f33..8b359ec28c 100644 --- a/coding/coding.pro +++ b/coding/coding.pro @@ -75,7 +75,6 @@ HEADERS += \ bzip2_compressor.hpp \ gzip_compressor.hpp \ timsort/timsort.hpp \ - bit_shift.hpp \ base64.hpp \ sha2.hpp \ value_opt_string.hpp \ diff --git a/coding/coding_tests/bit_shift_test.cpp b/coding/coding_tests/bit_shift_test.cpp deleted file mode 100644 index ba94fab2cc..0000000000 --- a/coding/coding_tests/bit_shift_test.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "base/SRC_FIRST.hpp" -#include "testing/testing.hpp" - -#include "std/limits.hpp" - -#include "coding/bit_shift.hpp" - - -UNIT_TEST(BitShift) -{ - TEST_EQUAL(INT_MIN, bits::ror(1, 1), ()); - uint8_t ui8 = 1; - TEST_EQUAL(0x80U, bits::ror(ui8, 1), ()); - uint16_t ui16 = 1; - TEST_EQUAL(0x8000U, bits::ror(ui16, 1), ()); - uint32_t ui32 = 1; - TEST_EQUAL(0x80000000U, bits::ror(ui32, 1), ()); - uint64_t ui64 = 1; - TEST_EQUAL(0x8000000000000000LL, bits::ror(ui64, 1), ()); - - uint16_t v = 0x58b1; - TEST_EQUAL(0x2b16, bits::ror(v, 3), ()); - TEST_EQUAL(v, bits::ror(v, 32), ()); - TEST_EQUAL(v, bits::ror(v, 0), ()); -} diff --git a/coding/coding_tests/coding_tests.pro b/coding/coding_tests/coding_tests.pro index c0121aed8d..4f92622d01 100644 --- a/coding/coding_tests/coding_tests.pro +++ b/coding/coding_tests/coding_tests.pro @@ -15,7 +15,6 @@ SOURCES += ../../testing/testingmain.cpp \ arithmetic_codec_test.cpp \ base64_for_user_id_test.cpp \ base64_test.cpp \ - bit_shift_test.cpp \ bit_streams_test.cpp \ # blob_storage_test.cpp \ bzip2_test.cpp \ diff --git a/xcode/coding/coding.xcodeproj/project.pbxproj b/xcode/coding/coding.xcodeproj/project.pbxproj index c1e8e484c2..e733dbb284 100644 --- a/xcode/coding/coding.xcodeproj/project.pbxproj +++ b/xcode/coding/coding.xcodeproj/project.pbxproj @@ -18,7 +18,6 @@ 675342811A3F588C00A0A8C3 /* arithmetic_codec.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753422A1A3F588B00A0A8C3 /* arithmetic_codec.hpp */; }; 675342821A3F588C00A0A8C3 /* base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6753422B1A3F588B00A0A8C3 /* base64.cpp */; }; 675342831A3F588C00A0A8C3 /* base64.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753422C1A3F588B00A0A8C3 /* base64.hpp */; }; - 675342841A3F588C00A0A8C3 /* bit_shift.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753422D1A3F588B00A0A8C3 /* bit_shift.hpp */; }; 675342851A3F588C00A0A8C3 /* bit_streams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6753422E1A3F588B00A0A8C3 /* bit_streams.cpp */; }; 675342861A3F588C00A0A8C3 /* bit_streams.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6753422F1A3F588B00A0A8C3 /* bit_streams.hpp */; }; 675342871A3F588C00A0A8C3 /* blob_indexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675342301A3F588B00A0A8C3 /* blob_indexer.cpp */; }; @@ -115,7 +114,6 @@ 6753422A1A3F588B00A0A8C3 /* arithmetic_codec.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = arithmetic_codec.hpp; sourceTree = ""; }; 6753422B1A3F588B00A0A8C3 /* base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = base64.cpp; sourceTree = ""; }; 6753422C1A3F588B00A0A8C3 /* base64.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = base64.hpp; sourceTree = ""; }; - 6753422D1A3F588B00A0A8C3 /* bit_shift.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = bit_shift.hpp; sourceTree = ""; }; 6753422E1A3F588B00A0A8C3 /* bit_streams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bit_streams.cpp; sourceTree = ""; }; 6753422F1A3F588B00A0A8C3 /* bit_streams.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = bit_streams.hpp; sourceTree = ""; }; 675342301A3F588B00A0A8C3 /* blob_indexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = blob_indexer.cpp; sourceTree = ""; }; @@ -258,7 +256,6 @@ 6753422A1A3F588B00A0A8C3 /* arithmetic_codec.hpp */, 6753422B1A3F588B00A0A8C3 /* base64.cpp */, 6753422C1A3F588B00A0A8C3 /* base64.hpp */, - 6753422D1A3F588B00A0A8C3 /* bit_shift.hpp */, 6753422E1A3F588B00A0A8C3 /* bit_streams.cpp */, 6753422F1A3F588B00A0A8C3 /* bit_streams.hpp */, 675342301A3F588B00A0A8C3 /* blob_indexer.cpp */, @@ -407,7 +404,6 @@ 675342AA1A3F588C00A0A8C3 /* lodepng_io.hpp in Headers */, 675342BC1A3F588C00A0A8C3 /* reader.hpp in Headers */, 675342D21A3F588C00A0A8C3 /* zip_creator.hpp in Headers */, - 675342841A3F588C00A0A8C3 /* bit_shift.hpp in Headers */, 675342A91A3F588C00A0A8C3 /* lodepng_io_private.hpp in Headers */, 675342B11A3F588C00A0A8C3 /* multilang_utf8_string.hpp in Headers */, 675342D41A3F588C00A0A8C3 /* zip_reader.hpp in Headers */,