mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
BUGFIX: Integer and float comparisons always return true
This commit is contained in:
@@ -5,8 +5,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define TOY_VERSION_MAJOR 1
|
#define TOY_VERSION_MAJOR 1
|
||||||
#define TOY_VERSION_MINOR 0
|
#define TOY_VERSION_MINOR 1
|
||||||
#define TOY_VERSION_PATCH 1
|
#define TOY_VERSION_PATCH 0
|
||||||
#define TOY_VERSION_BUILD __DATE__ " " __TIME__
|
#define TOY_VERSION_BUILD __DATE__ " " __TIME__
|
||||||
|
|
||||||
//platform/compiler-specific instructions
|
//platform/compiler-specific instructions
|
||||||
|
|||||||
@@ -241,10 +241,10 @@ bool Toy_literalsAreEqual(Toy_Literal lhs, Toy_Literal rhs) {
|
|||||||
// ints and floats are compatible
|
// ints and floats are compatible
|
||||||
if ((TOY_IS_INTEGER(lhs) || TOY_IS_FLOAT(lhs)) && (TOY_IS_INTEGER(rhs) || TOY_IS_FLOAT(rhs))) {
|
if ((TOY_IS_INTEGER(lhs) || TOY_IS_FLOAT(lhs)) && (TOY_IS_INTEGER(rhs) || TOY_IS_FLOAT(rhs))) {
|
||||||
if (TOY_IS_INTEGER(lhs)) {
|
if (TOY_IS_INTEGER(lhs)) {
|
||||||
return TOY_AS_INTEGER(lhs) + TOY_AS_FLOAT(rhs);
|
return TOY_AS_INTEGER(lhs) == TOY_AS_FLOAT(rhs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return TOY_AS_FLOAT(lhs) + TOY_AS_INTEGER(rhs);
|
return TOY_AS_FLOAT(lhs) == TOY_AS_INTEGER(rhs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user