On 13 Nov., 22:48, Robert Kern <[EMAIL PROTECTED]> wrote:
> Slaunger wrote:
> > It is always good to ask yourself a question.
> > I had forgooten about the reduce function
>
> > I guess this implementation
>
> > from numpy import *
>
> > def compl_add_uint16(a, b):
> > c = a + b
> > c += c
Slaunger wrote:
It is always good to ask yourself a question.
I had forgooten about the reduce function
I guess this implementation
from numpy import *
def compl_add_uint16(a, b):
c = a + b
c += c >> 16
return c & 0x
def compl_one_checksum(uint16s):
return reduce(compl_add
It is always good to ask yourself a question.
I had forgooten about the reduce function
I guess this implementation
from numpy import *
def compl_add_uint16(a, b):
c = a + b
c += c >> 16
return c & 0x
def compl_one_checksum(uint16s):
return reduce(compl_add_uint16, uint16s,
I know there must be a simple method to do this.
I have implemented this function for calculating a checksum based on a
ones complement addition:
def complement_ones_checksum(ints):
"""
Returns a complements one checksum based
on a specified numpy.array of dtype=uint16
"""
res