packages feed

chiphunk 0.1.0.1 → 0.1.0.2

raw patch · 2 files changed

+71/−2 lines, 2 files

Files

+ Chipmunk2D-7.0.2/src/prime.h view
@@ -0,0 +1,68 @@+/* Copyright (c) 2013 Scott Lembcke and Howling Moon Software+ * + * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to deal+ * in the Software without restriction, including without limitation the rights+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+ * copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ * + * The above copyright notice and this permission notice shall be included in+ * all copies or substantial portions of the Software.+ * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+ * SOFTWARE.+ */++// Used for resizing hash tables.+// Values approximately double.+// http://planetmath.org/encyclopedia/GoodHashTablePrimes.html+static int primes[] = {+	5,+	13,+	23,+	47,+	97,+	193,+	389,+	769,+	1543,+	3079,+	6151,+	12289,+	24593,+	49157,+	98317,+	196613,+	393241,+	786433,+	1572869,+	3145739,+	6291469,+	12582917,+	25165843,+	50331653,+	100663319,+	201326611,+	402653189,+	805306457,+	1610612741,+	0,+};++static inline int+next_prime(int n)+{+	int i = 0;+	while(n > primes[i]){+		i++;+		cpAssertHard(primes[i], "Tried to resize a hash table to a size greater than 1610612741 O_o"); // realistically this should never happen+	}+	+	return primes[i];+}
chiphunk.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: d58a7de4888db68e4e113b78844f012f2a15a43d346c20e6854277dc186f3f4d+-- hash: c3a385a692c010c72a119863e600c217900dba199d83f7c9018487a5ec11bafc  name:           chiphunk-version:        0.1.0.1+version:        0.1.0.2 synopsis:       Haskell bindings for Chipmunk2D physics engine description:    Please see the README on GitHub at <https://github.com/CthulhuDen/chiphunk#readme> category:       Physics@@ -51,6 +51,7 @@     Chipmunk2D-7.0.2/include/chipmunk/cpTransform.h     Chipmunk2D-7.0.2/include/chipmunk/cpVect.h     src/Chiphunk/wrapper.h+    Chipmunk2D-7.0.2/src/prime.h  flag library-only   manual: False