#include "MathFunc.h" float Normalize(float Value, float Scale, float Min, float Max) { const float len = (Max - Min) / 2.0f; const float shift = (Max + Min) / 2.0f; return (Value - shift) * Scale / len; } short Rev16(short v) { asm("REV16 %1, %0" : "=r" (v) : "r" (v)); // v = v<<8 | v>>8; return v; }