mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
C: implement Long.compareUnsigned
This commit is contained in:
parent
c245eb08cd
commit
2e7e11292b
|
@ -27,6 +27,7 @@ public class LongIntrinsic implements Intrinsic {
|
|||
switch (method.getName()) {
|
||||
case "divideUnsigned":
|
||||
case "remainderUnsigned":
|
||||
case "compareUnsigned":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -42,6 +43,13 @@ public class LongIntrinsic implements Intrinsic {
|
|||
case "remainderUnsigned":
|
||||
writeBinary(context, invocation, "%");
|
||||
break;
|
||||
case "compareUnsigned":
|
||||
context.writer().print("teavm_compare_u64(");
|
||||
context.emit(invocation.getArguments().get(0));
|
||||
context.writer().print(", ");
|
||||
context.emit(invocation.getArguments().get(1));
|
||||
context.writer().print(")");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,9 @@ static inline int32_t teavm_compare_u32(int32_t a, int32_t b) {
|
|||
static inline int32_t teavm_compare_i64(int64_t a, int64_t b) {
|
||||
return a > b ? INT32_C(1) : a < b ? INT32_C(-1) : INT32_C(0);
|
||||
}
|
||||
static inline int32_t teavm_compare_u64(int64_t a, int64_t b) {
|
||||
return (uint64_t) a > (uint64_t) b ? INT32_C(1) : (uint64_t) a < (uint64_t) b ? INT32_C(-1) : INT32_C(0);
|
||||
}
|
||||
static inline int32_t teavm_compare_float(float a, float b) {
|
||||
return a > b ? INT32_C(1) : a < b ? INT32_C(-1) : a == b ? INT32_C(0) : INT32_C(1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user