Replace __alignof__() GCC-ism with sizeof(). Should produce exactly the same code on all architectures except perhap...

Original commit message from CVS:
Replace __alignof__() GCC-ism with sizeof().  Should produce exactly
the same code on all architectures except perhaps m68k.
This commit is contained in:
David Schleef 2003-01-21 20:50:27 +00:00
parent bab7be2c91
commit fb9d810263
2 changed files with 14 additions and 2 deletions

View file

@ -151,7 +151,13 @@ md5_process_bytes (const void *buffer, size_t len, GstMD5Sink *ctx)
size_t add = 128 - left_over > len ? len : 128 - left_over;
/* Only put full words in the buffer. */
add -= add % __alignof__ (guint32);
/* Forcing alignment here appears to be only an optimization.
* The glibc source uses __alignof__, which seems to be a
* gratuitous usage of a GCC extension, when sizeof() will
* work fine. (And don't question the sanity of using
* sizeof(guint32) instead of 4. */
/* add -= add % __alignof__ (guint32); */
add -= add % sizeof(guint32);
memcpy (&ctx->buffer[left_over], buffer, add);
ctx->buflen += add;

View file

@ -151,7 +151,13 @@ md5_process_bytes (const void *buffer, size_t len, GstMD5Sink *ctx)
size_t add = 128 - left_over > len ? len : 128 - left_over;
/* Only put full words in the buffer. */
add -= add % __alignof__ (guint32);
/* Forcing alignment here appears to be only an optimization.
* The glibc source uses __alignof__, which seems to be a
* gratuitous usage of a GCC extension, when sizeof() will
* work fine. (And don't question the sanity of using
* sizeof(guint32) instead of 4. */
/* add -= add % __alignof__ (guint32); */
add -= add % sizeof(guint32);
memcpy (&ctx->buffer[left_over], buffer, add);
ctx->buflen += add;