Line data Source code
1 : // Copyright (c) 2006-2022 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/murmur3
4 : // contact@m2osw.com
5 : //
6 : // This program is free software; you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation; either version 2 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License along
17 : // with this program; if not, write to the Free Software Foundation, Inc.,
18 : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 : #pragma once
20 :
21 :
22 : // catch2
23 : //
24 : #include <catch2/snapcatch2.hpp>
25 :
26 :
27 : // snapdev
28 : //
29 : #include <snapdev/hexadecimal_string.h>
30 :
31 :
32 : // C++
33 : //
34 : #include <string>
35 : #include <cstring>
36 : #include <cstdlib>
37 : #include <iostream>
38 :
39 :
40 : namespace SNAP_CATCH2_NAMESPACE
41 : {
42 :
43 :
44 4 : inline std::string hex32(std::uint32_t *hash)
45 : {
46 : //sprintf(buf, "%08x", *hash);
47 4 : return snapdev::int_to_hex(hash[0], false, 8);
48 : }
49 :
50 4227 : inline std::string hex128(std::uint32_t *hash)
51 : {
52 : //sprintf(buf, "%08x%08x%08x%08x", hash[0], hash[1], hash[2], hash[3]);
53 8454 : return snapdev::int_to_hex(hash[0], false, 8)
54 16908 : + snapdev::int_to_hex(hash[1], false, 8)
55 16908 : + snapdev::int_to_hex(hash[2], false, 8)
56 12681 : + snapdev::int_to_hex(hash[3], false, 8);
57 : }
58 :
59 :
60 :
61 : } // SNAP_CATCH2_NAMESPACE namespace
62 : // vim: ts=4 sw=4 et
|