X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=network_compression.h;h=f83f0f589dbd123377765d095cc04b9e31d9936f;hb=be5e25dee2c54c2a22ca3bbb5bbe0eb6149343be;hp=6ef08f93f69cb7c9de0bc3b9825a0472a4b5ff50;hpb=5388f705086600105358d9880e8895673ac0e247;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/network_compression.h b/network_compression.h index 6ef08f9..f83f0f5 100644 --- a/network_compression.h +++ b/network_compression.h @@ -1,7 +1,7 @@ #ifndef NETWORK_COMPRESSION_H #define NETWORK_COMPRESSION_H -#include "vg/vg_stdint.h" +#include "vg/vg_platform.h" #include "vg/vg_m.h" typedef struct bitpack_ctx bitpack_ctx; @@ -34,18 +34,20 @@ static void bitpack_bytes( bitpack_ctx *ctx, u32 bytes, void *data ){ ctx->bytes += bytes; } -static void bitpack_qf32( bitpack_ctx *ctx, u32 bits, - f32 min, f32 max, f32 *v ){ +static u32 bitpack_qf32( bitpack_ctx *ctx, u32 bits, + f32 min, f32 max, f32 *v ){ u32 mask = (0x1 << bits) - 1; if( ctx->mode == k_bitpack_compress ){ u32 a = vg_quantf( *v, bits, min, max ); bitpack_bytes( ctx, bits/8, &a ); + return a; } else { u32 a = 0; bitpack_bytes( ctx, bits/8, &a ); *v = vg_dequantf( a, bits, min, max ); + return a; } }