@@ -235,7 +235,7 @@ cdef int strides_ok(GpuArray a, strides):
235235 return 0
236236 upper += max_axis_offset
237237 else :
238- if lower < - max_axis_offset:
238+ if lower < < size_t > ( - max_axis_offset) :
239239 return 0
240240 lower += max_axis_offset
241241 return (upper + itemsize) <= size
@@ -874,7 +874,7 @@ def from_gpudata(size_t data, offset, dtype, shape, GpuContext context=None,
874874 free(cdims)
875875 free(cstrides)
876876
877- def array (proto , dtype = None , copy = True , order = None , int ndmin = 0 ,
877+ def array (proto , dtype = None , copy = True , order = None , unsigned int ndmin = 0 ,
878878 GpuContext context = None , cls = None ):
879879 """
880880 array(obj, dtype='float64', copy=True, order=None, ndmin=0, context=None, cls=None)
@@ -890,7 +890,7 @@ def array(proto, dtype=None, copy=True, order=None, int ndmin=0,
890890 :param order: memory layout of the result
891891 :type order: string
892892 :param ndmin: minimum number of result dimensions
893- :type ndmin: int
893+ :type ndmin: unsigned int
894894 :param context: allocation context
895895 :type context: GpuContext
896896 :param cls: result class (must inherit from GpuArray)
@@ -1384,21 +1384,24 @@ cdef GpuArray pygpu_reshape(GpuArray a, unsigned int nd, const size_t *newdims,
13841384 if compute_axis < 0 :
13851385 array_reshape(res, a, nd, newdims, ord , nocopy)
13861386 return res
1387- if compute_axis >= nd:
1387+ cdef unsigned int caxis = < unsigned int > compute_axis
1388+ if caxis >= nd:
13881389 raise ValueError (" You wanted us to compute the shape of a dimensions that don't exist" )
13891390
13901391 cdef size_t * cdims
13911392 cdef size_t tot = 1
1393+ cdef unsigned int i
13921394 for i in range (nd):
1393- if i != compute_axis :
1395+ if i != caxis :
13941396 tot *= newdims[i]
13951397 cdims = < size_t * > calloc(nd, sizeof(size_t))
13961398 if cdims == NULL :
13971399 raise MemoryError , " could not allocate cdims"
13981400
1401+ cdef size_t d
13991402 for i in range (nd):
14001403 d = newdims[i]
1401- if i == compute_axis :
1404+ if i == caxis :
14021405 d = a.size // tot
14031406
14041407 if d * tot != a.size:
@@ -1537,7 +1540,7 @@ cdef class GpuArray:
15371540 k = PyNumber_Index(key)
15381541 if k < 0 :
15391542 k += self .ga.dimensions[i]
1540- if k < 0 or k >= self .ga.dimensions[i]:
1543+ if k < 0 or ( < size_t > k) >= self .ga.dimensions[i]:
15411544 raise IndexError , " index %d out of bounds" % (i,)
15421545 start[0 ] = k
15431546 step[0 ] = 0
@@ -1546,9 +1549,7 @@ cdef class GpuArray:
15461549 pass
15471550
15481551 if isinstance (key, slice ):
1549- # C compiler complains about argument 1 (key) because it's
1550- # declared as a PyObject. But we know it's a slice so it's ok.
1551- PySlice_GetIndicesEx(< slice_object> key, self .ga.dimensions[i],
1552+ PySlice_GetIndicesEx(key, self .ga.dimensions[i],
15521553 start, stop, step, & dummy)
15531554 if stop[0 ] < start[0 ] and step[0 ] > 0 :
15541555 stop[0 ] = start[0 ]
0 commit comments