Skip to content

Commit

Permalink
typecast uint64 before comparing with int64
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Jun 6, 2024
1 parent 571cbef commit 2e8c62e
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Config/GraphBLAS.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -11856,7 +11856,7 @@ GrB_Info GxB_Vector_Iterator_seek (GxB_Iterator iterator, GrB_Index p) ;

#define GB_Vector_Iterator_seek(iterator, q) \
( \
(q >= iterator->pmax) ? \
(((int64_t) q) >= iterator->pmax) ? \
( \
/* the iterator is exhausted */ \
iterator->p = iterator->pmax, \
Expand Down
2 changes: 1 addition & 1 deletion Include/GraphBLAS.h
Original file line number Diff line number Diff line change
Expand Up @@ -11856,7 +11856,7 @@ GrB_Info GxB_Vector_Iterator_seek (GxB_Iterator iterator, GrB_Index p) ;

#define GB_Vector_Iterator_seek(iterator, q) \
( \
(q >= iterator->pmax) ? \
(((int64_t) q) >= iterator->pmax) ? \
( \
/* the iterator is exhausted */ \
iterator->p = iterator->pmax, \
Expand Down
1 change: 1 addition & 0 deletions JITpackage/Source/grb_jitpackage.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,6 @@ int main (int argc, char **argv)
fclose (fp) ;
free (Uncompressed_size) ;
free (Compressed_size) ;
return (0) ;
}

3 changes: 2 additions & 1 deletion Source/iterator/GB_Iterator_rc_seek.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
GrB_Info GB_Iterator_rc_seek
(
GxB_Iterator iterator,
GrB_Index j,
GrB_Index j_input,
bool jth_vector
)
{
Expand All @@ -27,6 +27,7 @@ GrB_Info GB_Iterator_rc_seek
// check if the iterator is exhausted
//--------------------------------------------------------------------------

int64_t j = (int64_t) j_input ;
if (j >= ((jth_vector) ? iterator->anvec : iterator->avdim))
{
iterator->pstart = 0 ;
Expand Down
27 changes: 14 additions & 13 deletions Source/iterator/GxB_Matrix_Iterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ GrB_Info GxB_Matrix_Iterator_next (GxB_Iterator iterator)
GrB_Info GxB_Matrix_Iterator_seek
(
GxB_Iterator iterator,
GrB_Index p
GrB_Index p_input
)
{
int64_t p = (int64_t) p_input ;
if (p >= iterator->pmax)
{
// the iterator is exhausted
Expand Down Expand Up @@ -262,13 +263,13 @@ void GxB_Matrix_Iterator_getIndex
{
if (iterator->by_col)
{
(*row) = iterator->Ai [iterator->p] ;
(*col) = iterator->k ;
(*row) = (GrB_Index) (iterator->Ai [iterator->p]) ;
(*col) = (GrB_Index) (iterator->k) ;
}
else
{
(*row) = iterator->k ;
(*col) = iterator->Ai [iterator->p] ;
(*row) = (GrB_Index) (iterator->k) ;
(*col) = (GrB_Index) (iterator->Ai [iterator->p]) ;
}
}
break ;
Expand All @@ -277,13 +278,13 @@ void GxB_Matrix_Iterator_getIndex
{
if (iterator->by_col)
{
(*row) = iterator->Ai [iterator->p] ;
(*col) = iterator->Ah [iterator->k] ;
(*row) = (GrB_Index) (iterator->Ai [iterator->p]) ;
(*col) = (GrB_Index) (iterator->Ah [iterator->k]) ;
}
else
{
(*row) = iterator->Ah [iterator->k] ;
(*col) = iterator->Ai [iterator->p] ;
(*row) = (GrB_Index) (iterator->Ah [iterator->k]) ;
(*col) = (GrB_Index) (iterator->Ai [iterator->p]) ;
}
}
break ;
Expand All @@ -293,13 +294,13 @@ void GxB_Matrix_Iterator_getIndex
{
if (iterator->by_col)
{
(*row) = iterator->p - iterator->pstart ;
(*col) = iterator->k ;
(*row) = (GrB_Index) (iterator->p - iterator->pstart) ;
(*col) = (GrB_Index) (iterator->k) ;
}
else
{
(*row) = iterator->k ;
(*col) = iterator->p - iterator->pstart ;
(*row) = (GrB_Index) (iterator->k) ;
(*col) = (GrB_Index) (iterator->p - iterator->pstart) ;
}
}
break ;
Expand Down
Loading

0 comments on commit 2e8c62e

Please sign in to comment.