Add functions needed for switch ref-counting fix
This commit is contained in:
parent
26680823ff
commit
b673108852
@ -29,6 +29,15 @@ namespace String_ {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//%
|
||||
int compareDecr(StringData *s, StringData *that) {
|
||||
int r = compare(s, that);
|
||||
if (r == 0)
|
||||
decr((uint32_t)that);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
//%
|
||||
int length(StringData *s) { return s->len; }
|
||||
|
||||
@ -112,6 +121,15 @@ namespace Number_ {
|
||||
int div(int x, int y) { return x / y; }
|
||||
//%
|
||||
int mod(int x, int y) { return x % y; }
|
||||
|
||||
//%
|
||||
bool eqDecr(int x, int y) {
|
||||
if(x == y) {
|
||||
decr(y);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Math_ {
|
||||
|
Loading…
Reference in New Issue
Block a user