[Numpy-discussion] Aligning an array on Windows

Francesc Altet faltet at carabos.com
Mon May 28 04:47:23 EDT 2007


El dv 25 de 05 del 2007 a les 14:19 -0700, en/na Timothy Hochberg va
escriure:
> Don't feel bad, when I had a very similar problem early on when we
> were first adding multiple types and it mystified me for considerably
> longer than this seems to have stumped you. 

Well, I wouldn't say the truth if I say that this doesn't help ;)

Anyway, I think that this piece of code is dangerous enough and in order
to avoid someone (including me!) tripping over it again, it would be
nice to apply the next 'patch':

Index: interp_body.c
===================================================================
--- interp_body.c       (revision 3053)
+++ interp_body.c       (working copy)
@@ -89,6 +89,9 @@
         unsigned int arg2 = params.program[pc+3];
         #define      arg3   params.program[pc+5]
         #define store_index params.index_data[store_in]
+        /* WARNING: From now on, only do references to params.mem[arg[123]]
+          & params.memsteps[arg[123]] inside the VEC_ARG[123] macros,
+           or you will risk accessing invalid addresses.  */
         #define reduce_ptr  (dest + flat_index(&store_index, j))
         #define i_reduce    *(long *)reduce_ptr
         #define f_reduce    *(double *)reduce_ptr

Cheers,

-- 
Francesc Altet    |  Be careful about using the following code --
Carabos Coop. V.  |  I've only proven that it works, 
www.carabos.com   |  I haven't tested it. -- Donald Knuth




More information about the NumPy-Discussion mailing list