Line data Source code
1 : /*
2 : * Copyright 2008-2009 Katholieke Universiteit Leuven
3 : *
4 : * Use of this software is governed by the MIT license
5 : *
6 : * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 : * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8 : */
9 :
10 : #include <isl_int.h>
11 :
12 >34066*10^7 : uint32_t isl_gmp_hash(mpz_t v, uint32_t hash)
13 : {
14 >34066*10^7 : int sa = v[0]._mp_size;
15 >34066*10^7 : int abs_sa = sa < 0 ? -sa : sa;
16 >34066*10^7 : unsigned char *data = (unsigned char *)v[0]._mp_d;
17 >34066*10^7 : unsigned char *end = data + abs_sa * sizeof(v[0]._mp_d[0]);
18 :
19 >34066*10^7 : if (sa < 0)
20 >16945*10^7 : isl_hash_byte(hash, 0xFF);
21 >30811*10^8 : for (; data < end; ++data)
22 >27404*10^8 : isl_hash_byte(hash, *data);
23 >34066*10^7 : return hash;
24 : }
|