mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Fix an overflow bug with f32 to s32 conversion.
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
# clip [output] [a] -> output = clamp(a, -1, 1)
|
# clip [output] [a] -> output = clamp(a, -1, 1)
|
||||||
#
|
#
|
||||||
# int [name] -> Declare an uninitialized 32-bit integer
|
# int [name] -> Declare an uninitialized 32-bit integer
|
||||||
|
# lng [name] -> Declare an uninitialized 64-bit integer
|
||||||
# flt [name] -> Declare an uninitialized 32-bit float
|
# flt [name] -> Declare an uninitialized 32-bit float
|
||||||
|
|
||||||
# r = (x - 128) << 8
|
# r = (x - 128) << 8
|
||||||
@@ -159,7 +160,7 @@ f32->s24 {
|
|||||||
# r = clip(x) * (0x7FFFFFFF + sign(x))
|
# r = clip(x) * (0x7FFFFFFF + sign(x))
|
||||||
f32->s32 {
|
f32->s32 {
|
||||||
flt c;
|
flt c;
|
||||||
int s;
|
lng s;
|
||||||
clip c x;
|
clip c x;
|
||||||
sig s x;
|
sig s x;
|
||||||
add s s 2147483647;
|
add s s 2147483647;
|
||||||
|
|||||||
@@ -455,6 +455,9 @@ std::string malgen_generate_code__conversion_func_inst(malgen_context* pContext,
|
|||||||
if (strcmp(pInst->name, "int") == 0) {
|
if (strcmp(pInst->name, "int") == 0) {
|
||||||
code += "int "; code += pInst->params[0];
|
code += "int "; code += pInst->params[0];
|
||||||
}
|
}
|
||||||
|
if (strcmp(pInst->name, "lng") == 0) {
|
||||||
|
code += "long long "; code += pInst->params[0];
|
||||||
|
}
|
||||||
if (strcmp(pInst->name, "flt") == 0) {
|
if (strcmp(pInst->name, "flt") == 0) {
|
||||||
code += "float "; code += pInst->params[0];
|
code += "float "; code += pInst->params[0];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user