This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mar 18 12:39, Craig Howland wrote: > On 03/18/2016 06:49 AM, Sebastian Huber wrote: > >... > >diff --git a/newlib/libc/stdlib/chacha_private.h b/newlib/libc/stdlib/chacha_private.h > >new file mode 100644 > >index 0000000..b48c981 > >--- /dev/null > >+++ b/newlib/libc/stdlib/chacha_private.h > >@@ -0,0 +1,224 @@ > >+/* > >+... > >+#include <stdint.h> > >+ > >+typedef uint8_t u8; > >+typedef uint32_t u32; > >+ > >+typedef struct > >+{ > >+ u32 input[16]; /* could be compressed */ > >+} chacha_ctx; > >+ > >+#define U8C(v) (v##U) > >+#define U32C(v) (v##U) > Not good, as may or may not match what is defined in stdint.h, and can be > inaccurate, for example if long is needed for 32 bits. However, they are > only used in the 2 lines below, so just get rid of these two defines. > (Realistically, I would expect it to still provide the correct results, but > it is definitely an error in usage.) > > >+ > >+#define U8V(v) ((u8)(v) & U8C(0xFF)) > >+#define U32V(v) ((u32)(v) & U32C(0xFFFFFFFF)) > > > #define U8V(v) ((u8)(v) & UINT8_C(0xFF)) > #define U32V(v) ((u32)(v) & UINT32_C(0xFFFFFFFF)) > (For that matter, the '& mask' is not needed, as the cast does it.) Pleae send a patch. Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat
Attachment:
signature.asc
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |