Skip to content

Commit

Permalink
Replace switch with if.
Browse files Browse the repository at this point in the history
Apparently enum values aren't considered "constant" enough to match against? Even though their value can't change?
  • Loading branch information
player-03 authored Jan 28, 2024
1 parent e9fa7d1 commit c041120
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/lime/tools/Architecture.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,25 @@ package lime.tools;

@:from private static function fromHostArchitecture(hostArchitecture:hxp.HostArchitecture):Architecture
{
switch (hostArchitecture)
if (hostArchitecture == HostArchitecture.ARMV6)
{
case HostArchitecture.ARMV6:
return ARMV6;
case HostArchitecture.ARMV7:
return ARMV7;
case HostArchitecture.ARM64:
return ARM64;
case HostArchitecture.X86:
return X86;
case HostArchitecture.X64:
return X64;
return ARMV6;
}
else if (hostArchitecture == HostArchitecture.ARMV7)
{
return ARMV7;
}
else if (hostArchitecture == HostArchitecture.ARM64)
{
return ARM64;
}
else if (hostArchitecture == HostArchitecture.X86)
{
return X86;
}
else /* if (hostArchitecture == HostArchitecture.X64) */
{
return X64;
}
}
}

0 comments on commit c041120

Please sign in to comment.