//size 文件大小
namespace fsys.size;
 
GB = 0x40000000;
MB = 0x100000;
KB = 0x400;
bytes = 1;
  
unitNames = { 
    [0x40000000]="GB";[0x100000]="MB";[0x400]="KB";[1]="bytes";
}
 
format = function(low=0,high=0,unit,precision=2){ 
	if( low == 0xFFFFFFFF  || high==0xFFFFFFFF) return null,"错误长度";
	
	if(!unit){
		if(high|| low > 0x40000000)
			unit = 0x40000000;
		elseif( low > 0x100000 )
			unit = 0x100000;
		elseif( low > 0x400 )
			unit = 0x400;
		else 
			unit = 1;
	} 
	
	var size = low/unit;
	if(high) size = size + high * ( 0xFFFFFFFF /unit) 
		
	return ..math.round( size,precision ),unit,unitNames[unit];
}

/**intellisense(fsys.size)
GB = 0x40000000;
MB = 0x100000;
KB = 0x400;
bytes = 1;
format(.(长度,长度高位,单位大小,精度) = 格式化大小,所有参数可选\n默认自动计算最大单位大小,精度默认为最大2位小数\n返回值依次为:大小,单位大小,单位名称\n\n建议改用math.size64实现此函数的功能
end intellisense**/
