[pypy-commit] pypy unsigned-dtypes: Add in Long and ULong dtypes

justinpeel noreply at buildbot.pypy.org
Thu Sep 1 20:19:52 CEST 2011


Author: Justin Peel <notmuchtotell at gmail.com>
Branch: unsigned-dtypes
Changeset: r46997:b15a2d4696be
Date: 2011-09-01 11:21 -0600
http://bitbucket.org/pypy/pypy/changeset/b15a2d4696be/

Log:	Add in Long and ULong dtypes

diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py
--- a/pypy/module/micronumpy/interp_dtype.py
+++ b/pypy/module/micronumpy/interp_dtype.py
@@ -8,7 +8,7 @@
 from pypy.module.micronumpy import signature
 from pypy.objspace.std.floatobject import float2string
 from pypy.rlib import rfloat
-from pypy.rlib.rarithmetic import widen
+from pypy.rlib.rarithmetic import LONG_BIT, widen
 from pypy.rlib.objectmodel import specialize, enforceargs
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rpython.lltypesystem import lltype, rffi
@@ -369,7 +369,21 @@
 class W_UInt64Dtype(IntegerArithmeticDtype, W_UInt64Dtype):
     pass
 
+if LONG_BIT == 32:
+    class W_LongDtype(W_Int32Dtype):
+        pass
 
+    class W_ULongDtype(W_UInt32Dtype):
+        pass
+else:
+    class W_LongDtype(W_Int64Dtype):
+        pass
+
+    class W_ULongDtype(W_UInt64Dtype):
+        pass
+
+W_LongDtype.num = 7
+W_ULongDtype.num = 8
 
 W_Float64Dtype = create_low_level_dtype(
     num = 12, kind = FLOATINGLTR, name = "float64",
@@ -389,8 +403,11 @@
 ALL_DTYPES = [
     W_BoolDtype,
     W_Int8Dtype, W_UInt8Dtype, W_Int16Dtype, W_UInt16Dtype,
-    W_Int32Dtype, W_UInt32Dtype, W_Int64Dtype, W_UInt64Dtype,
-    W_Float64Dtype
+    W_Int32Dtype, W_UInt32Dtype, W_LongDtype, W_ULongDtype,
+    W_Int64Dtype, W_UInt64Dtype,
+    W_Float64Dtype, #float32 fill-in for now
+    W_Float64Dtype,
+    W_Float64Dtype, #float96 fill-in for now
 ]
 
 dtypes_by_alias = unrolling_iterable([
diff --git a/pypy/module/micronumpy/interp_ufuncs.py b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -270,4 +270,4 @@
         setattr(self, ufunc_name, ufunc)
 
 def get(space):
-    return space.fromcache(UfuncState)
\ No newline at end of file
+    return space.fromcache(UfuncState)


More information about the pypy-commit mailing list