Browse Source

no haxe.lang package

Nicolas Cannasse 13 years ago
parent
commit
e45e527d0f
1 changed files with 12 additions and 14 deletions
  1. 12 14
      std/cs/_std/FieldLookup.hx

+ 12 - 14
std/cs/_std/FieldLookup.hx

@@ -1,12 +1,10 @@
-package haxe.lang;
-
 @:native('haxe.lang.FieldLookup')
-@:static private class FieldLookup 
+@:static private class FieldLookup
 {
 
 	@:private private static var fieldIds:Array<Int>;
 	@:private private static var fields:Array<String>;
-	
+
 	//s cannot be null here
 	private static inline function doHash(s:String):Int
 	{
@@ -15,17 +13,17 @@ package haxe.lang;
 		{
 			acc = (( 223 * (acc >> 1) + s.charCodeAt(i) ) << 1);
 		}
-		
+
 		return acc >>> 1; //always positive
 	}
-	
+
 	public static function lookupHash(key:Int):String
 	{
 		//start of binary search algorithm
 		var ids = fieldIds;
 		var min = 0;
 		var max = ids.length;
-		
+
 		while (min < max)
 		{
 			var mid = Std.int(min + (max - min) / 2); //overflow safe
@@ -42,18 +40,18 @@ package haxe.lang;
 		//if not found, it's definately an error
 		throw "Field not found for hash " + key;
 	}
-	
+
 	public static function hash(s:String):Int
 	{
 		if (s == null) return 0;
-		
+
 		var key = doHash(s);
-		
+
 		//start of binary search algorithm
 		var ids = fieldIds;
 		var min = 0;
 		var max = ids.length;
-		
+
 		while (min < max)
 		{
 			var mid = Std.int(min + (max - min) / 2); //overflow safe
@@ -75,12 +73,12 @@ package haxe.lang;
 		fields.insert(min, s);
 		return key;
 	}
-	
+
 	public static function findHash(hash:Int, hashs:Array<Int>):Int
 	{
 		var min = 0;
 		var max = hashs.length;
-		
+
 		while (min < max)
 		{
 			var mid = Std.int((max + min) / 2); //overflow safe
@@ -97,5 +95,5 @@ package haxe.lang;
 		//if not found, return a negative value of where it should be inserted
 		return ~min;
 	}
-	
+
 }