Skip to content

Commit

Permalink
kernel: fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
James Mitchell committed Apr 5, 2018
1 parent c6174ff commit 0dbcf48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/precord.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static inline void SET_LEN_PREC(Obj rec, UInt nr)
static inline void SET_RNAM_PREC(Obj rec, UInt i, UInt rnam)
{
GAP_ASSERT(IS_PREC_OR_COMOBJ(rec));
GAP_ASSERT(i <= CAPACITY_PREC(rec));
GAP_ASSERT(i <= (UInt) CAPACITY_PREC(rec));

This comment has been minimized.

Copy link
@fingolfin

fingolfin Apr 5, 2018

Member

I'd rather have CAPACITY_PREC return an UInt

*(UInt *)(ADDR_OBJ(rec)+2*(i)) = rnam;
}

Expand All @@ -131,7 +131,7 @@ static inline void SET_RNAM_PREC(Obj rec, UInt i, UInt rnam)
static inline UInt GET_RNAM_PREC(Obj rec, UInt i)
{
GAP_ASSERT(IS_PREC_OR_COMOBJ(rec));
GAP_ASSERT(i <= CAPACITY_PREC(rec));
GAP_ASSERT(i <= (UInt) CAPACITY_PREC(rec));
return *(const UInt *)(CONST_ADDR_OBJ(rec)+2*(i));
}

Expand All @@ -146,7 +146,7 @@ static inline UInt GET_RNAM_PREC(Obj rec, UInt i)
static inline void SET_ELM_PREC(Obj rec, UInt i, Obj val)
{
GAP_ASSERT(IS_PREC_OR_COMOBJ(rec));
GAP_ASSERT(i <= CAPACITY_PREC(rec));
GAP_ASSERT(i <= (UInt) CAPACITY_PREC(rec));
*(ADDR_OBJ(rec)+2*(i)+1) = val;
}

Expand All @@ -161,7 +161,7 @@ static inline void SET_ELM_PREC(Obj rec, UInt i, Obj val)
static inline Obj GET_ELM_PREC(Obj rec, UInt i)
{
GAP_ASSERT(IS_PREC_OR_COMOBJ(rec));
GAP_ASSERT(i <= CAPACITY_PREC(rec));
GAP_ASSERT(i <= (UInt) CAPACITY_PREC(rec));
return *(CONST_ADDR_OBJ(rec)+2*(i)+1);
}

Expand Down
4 changes: 2 additions & 2 deletions src/stringobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static inline Obj GET_ELM_STRING(Obj list, Int pos)
{
GAP_ASSERT(IS_STRING_REP(list));
GAP_ASSERT(pos > 0);
GAP_ASSERT(pos <= GET_LEN_STRING(list));
GAP_ASSERT((UInt) pos <= GET_LEN_STRING(list));
UChar c = CHARS_STRING(list)[pos - 1];
return ObjsChar[c];
}
Expand All @@ -222,7 +222,7 @@ static inline void SET_ELM_STRING(Obj list, Int pos, Obj val)
{
GAP_ASSERT(IS_STRING_REP(list));
GAP_ASSERT(pos > 0);
GAP_ASSERT(pos <= GET_LEN_STRING(list));
GAP_ASSERT((UInt) pos <= GET_LEN_STRING(list));
GAP_ASSERT(TNUM_OBJ(val) == T_CHAR);
UChar * ptr = CHARS_STRING(list) + (pos - 1);
*ptr = CHAR_VALUE(val);
Expand Down

0 comments on commit 0dbcf48

Please sign in to comment.