Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hivert committed Jun 19, 2018
1 parent 14b7845 commit d17af94
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ IncludeCategories:
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentWidth: 2
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
Expand Down
31 changes: 10 additions & 21 deletions include/perm16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,16 @@ const std::array<uint8_t, 16> &as_array(const epu8& v) const {
return reinterpret_cast<const std::array<unsigned char, 16> &>(v);
}

// The following two functions are refused by clang++
// const uint8_t & operator[](uint64_t i) const { return v[i]; }
// uint8_t & operator[](uint64_t i) { return v[i]; }
const uint8_t &operator[](uint64_t i) const { return as_array()[i]; }
uint8_t &operator[](uint64_t i) { return as_array()[i]; }

// Auto is only valid here in C++14
using iter = std::array<uint8_t, 16>::iterator;
iter begin() { return as_array().begin(); }
iter end() { return as_array().end(); }

inline bool operator==(const Vect16 &b) const;
inline bool operator!=(const Vect16 &b) const;
inline bool operator<(const Vect16 &b) const;
inline char less_partial(const Vect16 &b, int k) const;
inline Vect16 permuted(const Vect16 &other) const;
inline Vect16 sorted() const;
inline Vect16 sorted8() const;
inline Vect16 revsorted() const;
inline Vect16 revsorted8() const;
inline bool is_sorted() const;
inline bool equal(epu8 a, epu8 b) const;
inline bool not_equal(epu8 a, epu8 b) const;
inline bool less(epu8 a, epu8 b) const;
inline char less_partial(epu8 a, epu8 b, int k) const;
inline epu8 permuted(epu8 a, epu8 b) const;
inline epu8 sorted(epu8 a) const;
inline epu8 sorted8(epu8 a) const;
inline epu8 revsorted(epu8 a) const;
inline epu8 revsorted8(epu8 a) const;
inline bool is_sorted(epu8 a) const;

inline Vect16 remove_dups() const;

Expand Down
7 changes: 7 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/fall

add_definitions (-DBOOST_TEST_DYN_LINK)

add_executable (test_epu test_epu.cpp)
target_link_libraries(test_epu
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
)
target_compile_options(test_epu PUBLIC -mavx -mtune=native -funroll-loops -flax-vector-conversions)

add_executable (test_perm16 test_perm16.cpp)
target_link_libraries(test_perm16
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
Expand All @@ -41,6 +47,7 @@ target_link_libraries(test_mincl
)
target_compile_options(test_mincl PUBLIC -mavx -mtune=native -funroll-loops -flax-vector-conversions)

add_test (TestEPU test_epu)
add_test (TestPerm16 test_perm16)
add_test (TestPermAll test_perm_all)
add_test (TestMultIncl test_mincl)
Expand Down

0 comments on commit d17af94

Please sign in to comment.