Do actual domain resolution
[carveJwlIkooP6JGAAIwe30JlM.git] / network_compression.h
index d4e3655a2098d2c9092bf960fc05372a43d0839a..f83f0f589dbd123377765d095cc04b9e31d9936f 100644 (file)
@@ -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;
@@ -28,24 +28,26 @@ static void bitpack_bytes( bitpack_ctx *ctx, u32 bytes, void *data ){
          if( index < ctx->buffer_len )
             ext[i] = ctx->buffer[index];
          else
-            return;
+            ext[i] = 0x00;
       }
    }
    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;
    }
 }