Skip to content

Commit

Permalink
my_swap(): Save '&' instrs by casting to U8
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed Jul 24, 2021
1 parent 31493b3 commit dfe5b3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions perl.h
Expand Up @@ -4178,13 +4178,13 @@ struct ptr_tbl {

PERL_STATIC_INLINE U32
my_swap32(const U32 x) {
return ((x & 0xFF) << 24) | ((x >> 24) & 0xFF)
return ((U8) (x) << 24) | ((U8) (x >> 24))
| ((x & 0x0000FF00) << 8) | ((x & 0x00FF0000) >> 8);
}

PERL_STATIC_INLINE U16
my_swap16(const U16 x) {
return ((x & 0xFF) << 8) | ((x >> 8) & 0xFF);
return (((U8) x) << 8) | ((U8) (x >> 8));
}

# define htonl(x) my_swap32(x)
Expand Down

0 comments on commit dfe5b3b

Please sign in to comment.