def test_int32(self): import sys import numpypy as numpy x = numpy.int32(23) assert x == 23 assert numpy.int32(2147483647) == 2147483647 assert numpy.int32('2147483647') == 2147483647 if sys.maxint > 2 ** 31 - 1: assert numpy.int32(2147483648) == -2147483648 assert numpy.int32('2147483648') == -2147483648 else: raises(OverflowError, numpy.int32, 2147483648) raises(OverflowError, numpy.int32, '2147483648') assert numpy.dtype('int32') is numpy.dtype(numpy.int32)
def get_value(s): v = np.int32(0) for i in s: if i == 0: continue v = v | 1 << (i-1) return v
def get_value_without_v(s,skip): v = np.int32(0) for i in s: if i ==0 or i == skip:continue v = v | 1 << (i-1) return v