1*37034db8STobias Grosser /* 2*37034db8STobias Grosser * Copyright 2016 Sven Verdoolaege 3*37034db8STobias Grosser * 4*37034db8STobias Grosser * Use of this software is governed by the MIT license 5*37034db8STobias Grosser * 6*37034db8STobias Grosser * Written by Sven Verdoolaege 7*37034db8STobias Grosser */ 8*37034db8STobias Grosser 9*37034db8STobias Grosser #include <isl_pw_macro.h> 10*37034db8STobias Grosser #include <isl/hash.h> 11*37034db8STobias Grosser 12*37034db8STobias Grosser /* Return a hash value that digests "pw". 13*37034db8STobias Grosser */ FN(PW,get_hash)14*37034db8STobias Grosseruint32_t FN(PW,get_hash)(__isl_keep PW *pw) 15*37034db8STobias Grosser { 16*37034db8STobias Grosser int i; 17*37034db8STobias Grosser uint32_t hash; 18*37034db8STobias Grosser 19*37034db8STobias Grosser if (!pw) 20*37034db8STobias Grosser return 0; 21*37034db8STobias Grosser 22*37034db8STobias Grosser hash = isl_hash_init(); 23*37034db8STobias Grosser for (i = 0; i < pw->n; ++i) { 24*37034db8STobias Grosser uint32_t set_hash, el_hash; 25*37034db8STobias Grosser 26*37034db8STobias Grosser set_hash = isl_set_get_hash(pw->p[i].set); 27*37034db8STobias Grosser isl_hash_hash(hash, set_hash); 28*37034db8STobias Grosser el_hash = FN(EL,get_hash)(pw->p[i].FIELD); 29*37034db8STobias Grosser isl_hash_hash(hash, el_hash); 30*37034db8STobias Grosser } 31*37034db8STobias Grosser 32*37034db8STobias Grosser return hash; 33*37034db8STobias Grosser } 34