mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Share method extensions across modules by default. Fix bug in string split.
This commit is contained in:
committed by
Christoffer Lerno
parent
dcf0b4c580
commit
abf0f64ac0
@@ -172,7 +172,7 @@ fn char[][] split(char[] s, char[] needle, Allocator* allocator = mem::current_a
|
||||
if (i == capacity)
|
||||
{
|
||||
capacity *= 2;
|
||||
holder = allocator.realloc(holder, capacity)!!;
|
||||
holder = allocator.realloc(holder, char[].sizeof * capacity)!!;
|
||||
}
|
||||
holder[i++] = res;
|
||||
}
|
||||
|
||||
@@ -86,6 +86,15 @@ define Complex64 = Complex<double>;
|
||||
**/
|
||||
macro abs(x) = $$abs(x);
|
||||
|
||||
/**
|
||||
* @require values::@is_int(x) `The input must be an integer`
|
||||
**/
|
||||
macro sign(x)
|
||||
{
|
||||
if (!x) return ($typeof(x))0;
|
||||
return ($typeof(x))(x < 0 ? -1 : 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @require values::@is_floatlike(x) `The input must be a floating point value or float vector`
|
||||
**/
|
||||
|
||||
Reference in New Issue
Block a user