|
Packit |
fb9d21 |
/*
|
|
Packit |
fb9d21 |
* Copyright 2008-2009 Katholieke Universiteit Leuven
|
|
Packit |
fb9d21 |
*
|
|
Packit |
fb9d21 |
* Use of this software is governed by the MIT license
|
|
Packit |
fb9d21 |
*
|
|
Packit |
fb9d21 |
* Written by Sven Verdoolaege, K.U.Leuven, Departement
|
|
Packit |
fb9d21 |
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
|
|
Packit |
fb9d21 |
*/
|
|
Packit |
fb9d21 |
|
|
Packit |
fb9d21 |
#include <isl_int.h>
|
|
Packit |
fb9d21 |
|
|
Packit |
fb9d21 |
uint32_t isl_gmp_hash(mpz_t v, uint32_t hash)
|
|
Packit |
fb9d21 |
{
|
|
Packit |
fb9d21 |
int sa = v[0]._mp_size;
|
|
Packit |
fb9d21 |
int abs_sa = sa < 0 ? -sa : sa;
|
|
Packit |
fb9d21 |
unsigned char *data = (unsigned char *)v[0]._mp_d;
|
|
Packit |
fb9d21 |
unsigned char *end = data + abs_sa * sizeof(v[0]._mp_d[0]);
|
|
Packit |
fb9d21 |
|
|
Packit |
fb9d21 |
if (sa < 0)
|
|
Packit |
fb9d21 |
isl_hash_byte(hash, 0xFF);
|
|
Packit |
fb9d21 |
for (; data < end; ++data)
|
|
Packit |
fb9d21 |
isl_hash_byte(hash, *data);
|
|
Packit |
fb9d21 |
return hash;
|
|
Packit |
fb9d21 |
}
|