[Numpy-discussion] RE: Numpy

rlw at stsci.edu rlw at stsci.edu
Wed Dec 6 06:51:21 CST 2000


A suggestion for an easy way to fix this problem: use float instead of
long.  Presumably floats are always 4 bytes.
				Rick

Paul Dubois writes:

>This was a patch that I put in before making this release. If you get 17.1.1
>it won't be in there.
>
> [...]
>
>cc: Error: Src/arrayobject.c, line 79: The switch statement containing this
>case label already has a case label for "8". (dupcase)
>            case sizeof(double):
>------------^
>error: command 'cc' failed with exit status 1
>tc05:/usr/tmp/chase/Numeric-17.1.2[408]
>
>
>int do_sliced_copy(char *dest, int *dest_strides, int *dest_dimensions,
>                   int dest_nd, char *src, int *src_strides,
>                   int *src_dimensions, int src_nd, int elsize,
>                   int copies) {
>        int i, j;
>
>        if (src_nd == 0 && dest_nd == 0) {
>            switch(elsize) {
>            case sizeof(char):
>                memset(dest, *src, copies);
>                break;
>            case sizeof(short):
>                for(j=copies; j; --j, dest += sizeof(short))
>                    *(short*)dest = *(short*)src;
>                break;
>            case sizeof(long):
>                for(j=copies; j; --j, dest += sizeof(int))
>                    *(int*)dest = *(int*)src;
>                break;
>            case sizeof(double):
>                for(j=copies; j; --j, dest += sizeof(double))
>                    *(double*)dest = *(double*)src;
>                break;
>            default:
>                for(j=copies; j; --j, dest += elsize)
>                    memcpy(dest, src, elsize);
>            }
>            return 0;
>        }



More information about the Numpy-discussion mailing list