From b102e12253078e8c0ebdeeb5e1893ea6a025a700 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 18 Oct 2010 11:39:47 +0200 Subject: *: use SWAP_BE64 instead of open-coding it Signed-off-by: Denys Vlasenko --- libbb/hash_md5.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'libbb/hash_md5.c') diff --git a/libbb/hash_md5.c b/libbb/hash_md5.c index 051c8ede4..9de27f1d9 100644 --- a/libbb/hash_md5.c +++ b/libbb/hash_md5.c @@ -417,11 +417,9 @@ void FAST_FUNC md5_end(md5_ctx_t *ctx, void *resbuf) if (remaining >= 8) { /* Store the 64-bit counter of bits in the buffer in BE format */ uint64_t t = ctx->total64 << 3; - unsigned i; - for (i = 0; i < 8; i++) { - ctx->wbuffer[56 + i] = t; - t >>= 8; - } + t = SWAP_BE64(t); + /* wbuffer is suitably aligned for this */ + *(uint64_t *) (&ctx->wbuffer[64 - 8]) = t; } md5_process_block64(ctx); if (remaining >= 8) -- cgit v1.2.3