Skip to content

Commit

Permalink
Merge pull request #250 from azrafe7/int-min-max
Browse files Browse the repository at this point in the history
HXP.INT_MIN/MAX_VALUE + small fix for seed clamping (fixes #242) + inite...
  • Loading branch information
MattTuttle committed Mar 5, 2014
2 parents c79b63e + 7058a57 commit fc66bd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions com/haxepunk/HXP.hx
Expand Up @@ -51,10 +51,15 @@ class HXP
public static inline function get_NUMBER_MAX_VALUE(): Float { return 179 * Math.pow(10, 306); } // 1.79e+308
#end

/**
* Flash equivalent: int.MIN_VALUE
*/
public static inline var INT_MIN_VALUE = -2147483648;

/**
* Flash equivalent: int.MAX_VALUE
*/
public static inline var INT_MAX_VALUE = 2147483646;
public static inline var INT_MAX_VALUE = 2147483647;

/**
* The color black (as an Int)
Expand Down Expand Up @@ -699,7 +704,7 @@ class HXP
public static var randomSeed(default, set):Int = 0;
private static inline function set_randomSeed(value:Int):Int
{
_seed = Std.int(clamp(value, 1.0, INT_MAX_VALUE));
_seed = Std.int(clamp(value, 1.0, INT_MAX_VALUE - 1));
randomSeed = _seed;
return _seed;
}
Expand Down
4 changes: 2 additions & 2 deletions com/haxepunk/Mask.hx
Expand Up @@ -94,8 +94,8 @@ class Mask
public function project(axis:Vector, projection:Projection):Void
{
var cur:Float,
max:Float = -9999999999.0,
min:Float = 9999999999.0;
max:Float = Math.NEGATIVE_INFINITY,
min:Float = Math.POSITIVE_INFINITY;

cur = -parent.originX * axis.x - parent.originY * axis.y;
if (cur < min)
Expand Down

0 comments on commit fc66bd8

Please sign in to comment.