Issue 236: Optimise integer divide.
Status:  WontFix
Owner: ----
Closed:  Apr 2013
Reported by lucadelt...@googlemail.com, Apr 21, 2013
// f:Int, g:Int
Std.int(f/g) gets compiled into
::Std_obj::_int((Float(f))/(Float(g)))

It seems like it'd be a rather simple optimization to have this compiled as f/g instead
Apr 25, 2013
Project Member #1 gameh...@gmail.com
This would involve looking for the "int" operator after the divide which is complicated.
You can use this:
var i:Int = untyped __cpp__("f/g");
To generate cpp:
int i = f/g;
If you are after extreme optimisations.
I think a more complete solution might be a Math.idiv(f,g) for all platforms.

Status: WontFix
May 19, 2013
#2 lucadelt...@googlemail.com
The problem is that untyped __cpp__("f/g") is not consistently going to work.

The variables in the compiled c++ code don't share the same names as the haxe variables all of the time, so this will not always be valid.

This is already done in the c# and java targets afaik (optimising to actual integer division).