Skip to content

Commit

Permalink
bswap: Modify prototype of stb_p (avoid type conversions)
Browse files Browse the repository at this point in the history
The function uses an uint8_t value, so show this in the function
prototype. Non-optimizing compilers will avoid unnecessary type
conversions from (u)int8_t to int and back to uint8_t when generating
calls of this inline function.

stw_p, stl_p and stq_p already use similar prototypes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
stweil authored and Michael Tokarev committed Mar 2, 2014
1 parent de580da commit 0064ace
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/qemu/bswap.h
Expand Up @@ -228,7 +228,7 @@ static inline int ldsb_p(const void *ptr)
return *(int8_t *)ptr;
}

static inline void stb_p(void *ptr, int v)
static inline void stb_p(void *ptr, uint8_t v)
{
*(uint8_t *)ptr = v;
}
Expand Down

0 comments on commit 0064ace

Please sign in to comment.