Hi all- 

I've been trying to use numpy arrays of ints as arrays of bit fields and mostly 
this works fine. However, it seems that the bitwise_* ufuncs do not support 
unsigned integer dtypes:

In [142]: np.uint64(5)&3
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/Users/claumann/<ipython-input-142-65e3301d5d07> in <module>()
----> 1 np.uint64(5)&3

TypeError: ufunc 'bitwise_and' not supported for the input types, and the 
inputs could not be safely coerced to any supported types according to the 
casting rule ''safe''

This seems odd as unsigned ints are the most natural bitfields I can think of 
-- the sign bit is just confusing when doing bit manipulation. Python itself of 
course doesn't make much a distinction between ints, longs, unsigned etc.

Is this a bug?

Thanks, Chris 

-- 
Chris Laumann
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to