Re: [dev] [sbase] [patch v2] Add md5sum
* sin <sin_AT_2f30.org> [2013-06-19 15:00:43 +0300]:
> > Integer promotion rules are nasty! I think something like
> > the following would still be ok?
> >
> > unsigned f(unsigned int c) { return c<<24U; }
>
> Although in this case we still have undefined behaviour
> because unsigned int can be 2 bytes by the standard.
>
> Depending on the ABI this might or might not be an issue.
don't worry about 2byte int, that does not work on linux
(and posix platforms in general)
bit shift does not do arithmetic conversion:
the signedness of the right operand does not matter,
integer promotion is applied independently to the two
sides
the usual way to do the char shift is
(uint32_t)c<<24
or
uint32_t w = c;
w << 24
Received on Wed Jun 19 2013 - 16:47:02 CEST
This archive was generated by hypermail 2.3.0
: Wed Jun 19 2013 - 16:48:04 CEST