Core: Change lookup rules, 2x speedup
This commit is contained in:
@@ -4,16 +4,16 @@ VariadicArguments :: (string: *char, args: []Any): Any
|
||||
|
||||
AnyArguments :: (values: []Any)
|
||||
for values
|
||||
Assert(it.type == S64)
|
||||
Assert(*(values[0].data->*S64) == 10)
|
||||
Assert(*(values[1].data->*S64) == 20)
|
||||
Assert(it.type == int)
|
||||
Assert(*(values[0].data->*int) == 10)
|
||||
Assert(*(values[1].data->*int) == 20)
|
||||
|
||||
/**
|
||||
* C++ version 0.4 char* style "itoa":
|
||||
* Written by Lukás Chmela
|
||||
* Released under GPLv3.
|
||||
*/
|
||||
IntegerToString :: (value: S64, result: *U8, base: S64): *U8
|
||||
IntegerToString :: (value: int, result: *U8, base: int): *U8
|
||||
// check that the base if valid
|
||||
if (base < 2) || (base > 36)
|
||||
*result = 0 // '
|
||||
@@ -22,7 +22,7 @@ IntegerToString :: (value: S64, result: *U8, base: S64): *U8
|
||||
ptr := result
|
||||
ptr1 := result
|
||||
tmp_char: U8
|
||||
tmp_value: S64
|
||||
tmp_value: int
|
||||
|
||||
for value != 0
|
||||
tmp_value = value
|
||||
@@ -63,8 +63,8 @@ FormatString :: (buffer: *U8, buffer_len: U64, string: String, args: []Any)
|
||||
Assert(arg_counter < Len(args), "Passed too many [%] to the string formating function")
|
||||
arg := args[arg_counter++]
|
||||
|
||||
if arg.type == S64
|
||||
value := *(arg.data->*S64)
|
||||
if arg.type == int
|
||||
value := *(arg.data->*int)
|
||||
itoa_buff: [64]U8
|
||||
p := IntegerToString(value, &itoa_buff[0], 10)
|
||||
|
||||
@@ -81,15 +81,15 @@ main :: (): int
|
||||
values := []Any{a, b}
|
||||
|
||||
for values
|
||||
Assert(it.type == S64)
|
||||
Assert(it.type == int)
|
||||
AnyArguments({a,b})
|
||||
c := VariadicArguments("Test", args = {a+b,b})
|
||||
Assert(*(c.data->*S64) == 30)
|
||||
Assert(*(c.data->*int) == 30)
|
||||
d := VariadicArguments("Test", {b,a})
|
||||
Assert(*(d.data->*S64) == b)
|
||||
Assert(*(d.data->*int) == b)
|
||||
|
||||
Assert(*(values[0].data->*S64) == 10)
|
||||
Assert(*(values[1].data->*S64) == 20)
|
||||
Assert(*(values[0].data->*int) == 10)
|
||||
Assert(*(values[1].data->*int) == 20)
|
||||
|
||||
buf: [128]U8
|
||||
FormatString(&buf[0], Len(buf), "Test % %", {32, 156})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
/*@feature_idea: labeled block
|
||||
/*@language_todo: labeled block
|
||||
|
||||
It acts just like a scope in C.
|
||||
BUT it can be turned into a goto label by adding another semicolon
|
||||
@@ -18,9 +18,11 @@ thing := 1
|
||||
thing2 := thing
|
||||
|
||||
:goto_block: for
|
||||
*/
|
||||
|
||||
/*
|
||||
@language_todo: Bring back named loads
|
||||
A :: #load "array.core"
|
||||
|
||||
|
||||
@reproduction:
|
||||
This kills the compiler due to referencing slice data
|
||||
|
||||
@@ -131,6 +133,7 @@ main :: (): int
|
||||
target_color.a = 255/2
|
||||
|
||||
for !WindowShouldClose()
|
||||
|
||||
WinX = GetScreenWidth()
|
||||
WinY = GetScreenHeight()
|
||||
MouseX = GetMouseX()
|
||||
|
||||
Reference in New Issue
Block a user