-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update test files' name; add support hash for i128 and u128 * update hash function; add an example of hash * add tests for hash of i128 and u128 * add desc for the example of hash
- Loading branch information
Showing
13 changed files
with
189 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "numbers.h" | ||
|
||
int main(int argc, char const *argv[]) { | ||
{ | ||
std::cout << "==== hash example for i128 ==== \n"; | ||
std::hash<numbers::i128> hasher; | ||
numbers::i128 a = 9; | ||
std::cout << "a= " << a << ", hash(a)= " << hasher(a) << '\n'; | ||
numbers::i128 b = 10; | ||
std::cout << "b= " << b << ", hash(b)= " << hasher(b) << '\n'; | ||
numbers::i128 c = 8526517779554707146; | ||
std::cout << "c= " << c << ", hash(c)= " << hasher(c) << '\n'; | ||
} | ||
|
||
{ | ||
std::cout << "==== hash example for u128 ==== \n"; | ||
std::hash<numbers::u128> hasher; | ||
numbers::u128 a = 9; | ||
std::cout << "a= " << a << ", hash(a)= " << hasher(a) << '\n'; | ||
numbers::u128 b = 8526517779554707146; | ||
std::cout << "b= " << b << ", hash(b)= " << hasher(b) << '\n'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "numbers.h" | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
std::cout << "==== size example ==== \n"; | ||
std::cout << "sizeof(numbers::i8) = "<< sizeof(numbers::i8) << '\n'; | ||
std::cout << "sizeof(numbers::i16) = "<< sizeof(numbers::i16) << '\n'; | ||
std::cout << "sizeof(numbers::i32) = "<< sizeof(numbers::i32) << '\n'; | ||
std::cout << "sizeof(numbers::i64) = "<< sizeof(numbers::i64) << '\n'; | ||
std::cout << "sizeof(numbers::i128) = "<< sizeof(numbers::i128) << '\n'; | ||
|
||
std::cout << "sizeof(numbers::u8) = "<< sizeof(numbers::u8) << '\n'; | ||
std::cout << "sizeof(numbers::u16) = "<< sizeof(numbers::u16) << '\n'; | ||
std::cout << "sizeof(numbers::u32) = "<< sizeof(numbers::u32) << '\n'; | ||
std::cout << "sizeof(numbers::u64) = "<< sizeof(numbers::u64) << '\n'; | ||
std::cout << "sizeof(numbers::u128) = "<< sizeof(numbers::u128) << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters