float16::ConvertFloatTo16bits
0x005be830 · 276 bytes · __cdecl
_ZN7float1620ConvertFloatTo16bitsEf
Decompiled
undefined (1 param)
/* float16::ConvertFloatTo16bits(float) */
uint float16::ConvertFloatTo16bits(float param_1)
{
int iVar1;
char cVar2;
uint uVar3;
float fVar4;
uint uVar5;
if (param_1 <= -65504.0) {
param_1 = -65504.0;
}
if (65504.0 <= param_1) {
param_1 = 65504.0;
}
uVar3 = ((uint)param_1 >> 0x1f) << 0xf;
fVar4 = ABS(param_1);
if (fVar4 != 0.0) {
if (((uint)param_1 >> 0x10 & 0x7f80) == 0) {
if (((uint)param_1 & 0x7fffff) != 0) {
return uVar3;
}
if (fVar4 == INFINITY) goto LAB_005be918;
}
else {
if (fVar4 == INFINITY) goto LAB_005be918;
if ((((ushort)((uint)param_1 >> 0x10) & 0x7f80) == 0x7f80) &&
(((uint)param_1 & 0x7fffff) != 0)) {
return uVar3;
}
}
uVar5 = (uint)param_1 >> 0x17 & 0xff;
iVar1 = uVar5 - 0x7f;
if ((-0x19 < iVar1) && (-0xf < iVar1)) {
if (iVar1 < 0x10) {
return (uVar5 - 0x70 & 0x1f) << 10 | uVar3 | ((uint)param_1 & 0x7fffff) >> 0xd;
}
LAB_005be918:
return uVar3 | 0x7bff;
}
cVar2 = (char)-uVar5;
if (-uVar5 + 0x70 < 10) {
uVar3 = uVar3 | ((int)((uint)param_1 & 0x7fffff) >> (cVar2 + 0x7eU & 0x1f)) +
(1 << (10U - (cVar2 + 'q') & 0x1f)) & 0xffff03ffU;
}
}
return uVar3;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.