> You can do clever memory slicing like this with numpy. For instance: > > breg = numpy.zeros((16,),numpy.uint8) > wreg = numpy.ndarray((8,),numpy.uint16,breg) > > This causes breg and wreg to share the same 16 bytes of memory. You > can define constants to access specific registers:
What I'm doing wrong? [srom...@compiler:~]$ cat test.py #!/usr/bin/python import numpy # Register array breg = numpy.zeros((16,),numpy.uint8) wreg = numpy.ndarray((8,), numpy.uint16, breg ) reg_A = 1 reg_F = 2 reg_AF = 1 reg_B = 3 reg_C = 4 reg_BC = 3 breg[reg_B] = 5 breg[reg_C] = 10 print breg[reg_B] print breg[reg_C] print wreg[reg_BC] [srom...@compiler:~]$ python test.py 5 10 0 ? -- http://mail.python.org/mailman/listinfo/python-list