Mercurial > projects > chipmunkd
comparison trunk/chipmunkd/cpSpaceHash.d @ 17:131331ebb599
cpVect toString method and some cleanup
author | Extrawurst |
---|---|
date | Thu, 09 Dec 2010 01:51:30 +0100 |
parents | df4ebc8add66 |
children |
comparison
equal
deleted
inserted
replaced
16:af2f61a96318 | 17:131331ebb599 |
---|---|
283 | 283 |
284 // The hash function itself. | 284 // The hash function itself. |
285 static cpHashValue | 285 static cpHashValue |
286 hash_func(cpHashValue x, cpHashValue y, cpHashValue n) | 286 hash_func(cpHashValue x, cpHashValue y, cpHashValue n) |
287 { | 287 { |
288 return cast(cpHashValue)((x*1640531513uL ^ y*2654435789uL) % n); | 288 return cast(cpHashValue)(( (x*1640531513uL) ^ (y*2654435789uL) ) % n); |
289 } | 289 } |
290 | 290 |
291 // Much faster than (int)floor(f) | 291 // Much faster than (int)floor(f) |
292 // Profiling showed floor() to be a sizable performance hog | 292 // Profiling showed floor() to be a sizable performance hog |
293 static int | 293 static int |