to_u32 :: #match {
(key: rawptr) -> u32 { return 0xcbf29ce7 ^ cast(u32) key; },
(key: i8) -> u32 { return ~~ key; },
+ (key: i16) -> u32 { return 0x9ce7 ^ ~~ key; },
(key: i32) -> u32 { return 0xcbf29ce7 ^ cast(u32) key; },
(key: i64) -> u32 { return cast(u32) (cast(u64) 0xcbf29ce7 ^ cast(u64) key); },
(key: str) -> u32 {
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="logo.svg"
inkscape:export-filename="C:\dev\onyx\docs\logos\logo.png"
- inkscape:export-xdpi="256"
- inkscape:export-ydpi="256"
+ inkscape:export-xdpi="512"
+ inkscape:export-ydpi="512"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="8.7988366"
- inkscape:cx="48.585969"
- inkscape:cy="60.519365"
- inkscape:window-width="2498"
- inkscape:window-height="1417"
- inkscape:window-x="54"
- inkscape:window-y="-8"
+ inkscape:cx="23.866792"
+ inkscape:cy="33.243031"
+ inkscape:window-width="1920"
+ inkscape:window-height="1057"
+ inkscape:window-x="1920"
+ inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px" />
// but it is important to change the code here.
// -brendanfh 2020/09/04
- AstLocal* var = for_node->var;
+ // NOTE: This might not be a range literal
+ AstStructLiteral *range = (AstStructLiteral *) for_node->iter;
u64 offset = 0;
StructMember low_mem, high_mem, step_mem;
emit_enter_structured_block(mod, &code, SBT_Basic_Loop);
emit_enter_structured_block(mod, &code, SBT_Continue_Block);
- WIL(WI_LOCAL_GET, iter_local);
- WIL(WI_LOCAL_GET, high_local);
- WI(WI_I32_GE_S);
- WID(WI_COND_JUMP, 0x02);
+ if (range->kind == Ast_Kind_Struct_Literal && (range->args.values[2]->flags & Ast_Flag_Comptime) != 0) {
+ AstNumLit *step_value = (AstNumLit *) range->args.values[2];
+ assert(step_value->kind == Ast_Kind_NumLit);
+
+ if (step_value->value.l >= 0) {
+ WIL(WI_LOCAL_GET, iter_local);
+ WIL(WI_LOCAL_GET, high_local);
+ WI(WI_I32_GE_S);
+ WID(WI_COND_JUMP, 0x02);
+ } else {
+ WIL(WI_LOCAL_GET, iter_local);
+ WIL(WI_LOCAL_GET, high_local);
+ WI(WI_I32_LT_S);
+ WID(WI_COND_JUMP, 0x02);
+ }
+
+ } else {
+ WIL(WI_LOCAL_GET, step_local);
+ WID(WI_I32_CONST, 0);
+ WI(WI_I32_GE_S);
+ WID(WI_IF_START, 0x40);
+ WIL(WI_LOCAL_GET, iter_local);
+ WIL(WI_LOCAL_GET, high_local);
+ WI(WI_I32_GE_S);
+ WID(WI_COND_JUMP, 0x03);
+ WI(WI_ELSE);
+ WIL(WI_LOCAL_GET, iter_local);
+ WIL(WI_LOCAL_GET, high_local);
+ WI(WI_I32_LT_S);
+ WID(WI_COND_JUMP, 0x03);
+ WI(WI_IF_END);
+ }
+
emit_block(mod, &code, for_node->stmt, 0);