Skip to content

Commit

Permalink
BUG: PR #227, Use npy_intp instead of long in mtrand.
Browse files Browse the repository at this point in the history
This fixes a problem on 64 bit Windows where a 64 bit index is
needed but long is only 32 bits.

Regenerate mtrand.c
  • Loading branch information
cgohlke authored and charris committed May 1, 2012
1 parent b452014 commit 862cc3b
Show file tree
Hide file tree
Showing 5 changed files with 2,870 additions and 2,448 deletions.
8 changes: 4 additions & 4 deletions numpy/random/mtrand/initarray.c
Expand Up @@ -107,13 +107,13 @@ init_genrand(rk_state *self, unsigned long s)
* key_length is its length
*/
extern void
init_by_array(rk_state *self, unsigned long init_key[], unsigned long key_length)
init_by_array(rk_state *self, unsigned long init_key[], npy_intp key_length)
{
/* was signed in the original code. RDH 12/16/2002 */
unsigned int i = 1;
unsigned int j = 0;
npy_intp i = 1;
npy_intp j = 0;
unsigned long *mt = self->key;
unsigned int k;
npy_intp k;

init_genrand(self, 19650218UL);
k = (RK_STATE_LEN > key_length ? RK_STATE_LEN : key_length);
Expand Down
5 changes: 3 additions & 2 deletions numpy/random/mtrand/initarray.h
@@ -1,6 +1,7 @@
#include "Python.h"
#include "numpy/arrayobject.h"
#include "randomkit.h"

extern void
init_by_array(rk_state *self, unsigned long init_key[],
unsigned long key_length);

npy_intp key_length);

0 comments on commit 862cc3b

Please sign in to comment.