Robin Becker wrote:

> > ULONG CalcTableChecksum(ULONG *Table, ULONG Length)
> > {
> > ULONG Sum = 0L;
> > ULONG *Endptr = Table+((Length+3) & ~3) / sizeof(ULONG);
> >
> > while (Table < EndPtr)
> >     Sum += *Table++;
> > return Sum;
> > }

Is this what you want?

import numpy
def CalcTableChecksum(Table, Length=None):
   tmp = numpy.array(Table,dtype=numpy.uint32)
   if Length == None: Length = tmp.size
   endptr = ((Length+3) & ~3) / 4
   return (tmp[0:endptr]).sum()

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to