# HG changeset patch # User ods15 # Date 1159768520 0 # Node ID 52ff3a5d161e2e8a656cf8f96dc565021e07c688 # Parent 9f6acced986e187dc79868a6010b698496591657 Original Commit: r6 | ods15 | 2006-09-16 20:36:31 +0300 (Sat, 16 Sep 2006) | 2 lines add correct and working put_float ... diff -r 9f6acced986e -r 52ff3a5d161e vorbis_enc.c --- a/vorbis_enc.c Mon Oct 02 05:55:18 2006 +0000 +++ b/vorbis_enc.c Mon Oct 02 05:55:20 2006 +0000 @@ -67,7 +67,13 @@ } static void put_float(PutBitContext * pb, float f) { - put_bits(pb, 32, *(uint32_t*)&f); + int exp, mant; + uint32_t res = 0; + mant = (int)ldexp(frexp(f, &exp), 20); + exp += 788 - 20; + if (mant < 0) { res |= (1 << 31); mant = -mant; } + res |= mant | (exp << 21); + put_bits(pb, 32, res); } static void put_codebook_header(PutBitContext * pb, codebook_t * cb) {