offline
Опыт:
53,013
Активность:
|
моя функция быстрей =).
даже тупо сказать самая быстрая которая тока возможна на джассе.
сейчас код скинут... (ну разбирайтесь уже сами)
Код:
function InitUSPBR takes nothing returns nothing
set USPData=InitGameCache("USPDataStore.bx")
set ANSI[48]="0"
set ANSI[49]="1"
set ANSI[50]="2"
set ANSI[51]="3"
set ANSI[52]="4"
set ANSI[53]="5"
set ANSI[54]="6"
set ANSI[55]="7"
set ANSI[56]="8"
set ANSI[57]="9"
set ANSI2[s2i("0")]=48
set ANSI2[s2i("1")]=49
set ANSI2[s2i("2")]=50
set ANSI2[s2i("3")]=51
set ANSI2[s2i("4")]=52
set ANSI2[s2i("5")]=53
set ANSI2[s2i("6")]=54
set ANSI2[s2i("7")]=55
set ANSI2[s2i("8")]=56
set ANSI2[s2i("9")]=57
set ANSI[65]="A"
set ANSI[66]="B"
set ANSI[67]="C"
set ANSI[68]="D"
set ANSI[69]="E"
set ANSI[70]="F"
set ANSI[71]="G"
set ANSI[72]="H"
set ANSI[73]="I"
set ANSI[74]="J"
set ANSI[75]="K"
set ANSI[76]="L"
set ANSI[77]="M"
set ANSI[78]="N"
set ANSI[79]="O"
set ANSI[80]="P"
set ANSI[81]="Q"
set ANSI[82]="R"
set ANSI[83]="S"
set ANSI[84]="T"
set ANSI[85]="U"
set ANSI[86]="V"
set ANSI[87]="W"
set ANSI[88]="X"
set ANSI[89]="Y"
set ANSI[90]="Z"
set ANSI2[s2i("A")]=65
set ANSI2[s2i("B")]=66
set ANSI2[s2i("C")]=67
set ANSI2[s2i("D")]=68
set ANSI2[s2i("E")]=69
set ANSI2[s2i("F")]=70
set ANSI2[s2i("G")]=71
set ANSI2[s2i("H")]=72
set ANSI2[s2i("I")]=73
set ANSI2[s2i("J")]=74
set ANSI2[s2i("K")]=75
set ANSI2[s2i("L")]=76
set ANSI2[s2i("M")]=77
set ANSI2[s2i("N")]=78
set ANSI2[s2i("O")]=79
set ANSI2[s2i("P")]=80
set ANSI2[s2i("Q")]=81
set ANSI2[s2i("R")]=82
set ANSI2[s2i("S")]=83
set ANSI2[s2i("T")]=84
set ANSI2[s2i("U")]=85
set ANSI2[s2i("V")]=86
set ANSI2[s2i("W")]=87
set ANSI2[s2i("X")]=88
set ANSI2[s2i("Y")]=89
set ANSI2[s2i("Z")]=90
set ANSI[97]="a"
set ANSI[98]="b"
set ANSI[99]="c"
set ANSI[100]="d"
set ANSI[101]="e"
set ANSI[102]="f"
set ANSI[103]="g"
set ANSI[104]="h"
set ANSI[105]="i"
set ANSI[106]="j"
set ANSI[107]="k"
set ANSI[108]="l"
set ANSI[109]="m"
set ANSI[110]="n"
set ANSI[111]="o"
set ANSI[112]="p"
set ANSI[113]="q"
set ANSI[114]="r"
set ANSI[115]="s"
set ANSI[116]="t"
set ANSI[117]="u"
set ANSI[118]="v"
set ANSI[119]="w"
set ANSI[120]="x"
set ANSI[121]="y"
set ANSI[122]="z"
set ANSI2[s2i("a")]=97
set ANSI2[s2i("b")]=98
set ANSI2[s2i("c")]=99
set ANSI2[s2i("d")]=100
set ANSI2[s2i("e")]=101
set ANSI2[s2i("f")]=102
set ANSI2[s2i("g")]=103
set ANSI2[s2i("h")]=104
set ANSI2[s2i("i")]=105
set ANSI2[s2i("j")]=106
set ANSI2[s2i("k")]=107
set ANSI2[s2i("l")]=108
set ANSI2[s2i("m")]=109
set ANSI2[s2i("n")]=110
set ANSI2[s2i("o")]=111
set ANSI2[s2i("p")]=112
set ANSI2[s2i("q")]=113
set ANSI2[s2i("r")]=114
set ANSI2[s2i("s")]=115
set ANSI2[s2i("t")]=116
set ANSI2[s2i("u")]=117
set ANSI2[s2i("v")]=118
set ANSI2[s2i("w")]=119
set ANSI2[s2i("x")]=120
set ANSI2[s2i("y")]=121
set ANSI2[s2i("z")]=122
set HEX[0]="0"
set HEX[1]="1"
set HEX[2]="2"
set HEX[3]="3"
set HEX[4]="4"
set HEX[5]="5"
set HEX[6]="6"
set HEX[7]="7"
set HEX[8]="8"
set HEX[9]="9"
set HEX[10]="a"
set HEX[11]="b"
set HEX[12]="c"
set HEX[13]="d"
set HEX[14]="e"
set HEX[15]="f"
set HEX2[s2i("0")]=0
set HEX2[s2i("1")]=1
set HEX2[s2i("2")]=2
set HEX2[s2i("3")]=3
set HEX2[s2i("4")]=4
set HEX2[s2i("5")]=5
set HEX2[s2i("6")]=6
set HEX2[s2i("7")]=7
set HEX2[s2i("8")]=8
set HEX2[s2i("9")]=9
set HEX2[s2i("a")]=10
set HEX2[s2i("A")]=10
set HEX2[s2i("b")]=11
set HEX2[s2i("B")]=11
set HEX2[s2i("c")]=12
set HEX2[s2i("C")]=12
set HEX2[s2i("d")]=13
set HEX2[s2i("D")]=13
set HEX2[s2i("e")]=14
set HEX2[s2i("E")]=14
set HEX2[s2i("f")]=15
set HEX2[s2i("F")]=15
set USPInited=true
endfunction
function I2ASCExec takes nothing returns nothing
local integer i=eax
set esx=ANSI[i/0x1000000]+ANSI[Modulo(i/0x10000,0x100)]+ANSI[Modulo(i/0x100,0x100)]+ANSI[Modulo(i,0x100)]
endfunction
function I2ASC takes integer i returns string
set eax=i
call ExecuteFunc("I2ASCExec")
return esx
endfunction
function ASC2IExec takes nothing returns nothing
local string s=esx
set eax=ANSI2[s2i(SubString(s,0,1))]*0x1000000+ANSI2[s2i(SubString(s,1,2))]*0x10000+ANSI2[s2i(SubString(s,2,3))]*0x100+ANSI2[s2i(SubString(s,3,4))]
endfunction
function ASC2I takes string s returns integer
set esx=s
call ExecuteFunc("ASC2IExec")
return eax
endfunction
function S2HEXExec takes nothing returns nothing
local string s=esx
local integer sl=StringLength(s)
local integer i=1
local integer i2=0
local integer pow=0
loop
exitwhen i>sl
set pow=R2I(Pow(0x10,sl-i))
set i2=i2+HEX2[s2i(SubString(s,i-1,i))]*pow
set i=i+1
endloop
set eax=i2
endfunction
function S2HEX takes string s returns integer
set esx=s
call ExecuteFunc("S2HEXExec")
return eax
endfunction
function S2HEXExec2 takes nothing returns nothing
local string s=esx
local integer sl=eax-eaxx
local integer i=1
local integer i2=0
local integer pow=0
loop
exitwhen i>sl
set pow=R2I(Pow(0x10,sl-i))
set i2=i2+HEX2[s2i(SubString(s,eaxx+i-2,eaxx+i-1))]*pow
set i=i+1
endloop
set eax=i2
endfunction
function S2HEX2 takes string s,integer min,integer max returns integer
set esx=s
set eaxx=min
set eax=max
call ExecuteFunc("S2HEXExec2")
return eax
endfunction
function ASC2IExec2 takes nothing returns nothing
local string s=esx
set eax=ANSI2[s2i(SubString(s,eaxx-1,eaxx))]*0x1000000+ANSI2[s2i(SubString(s,eaxx,eaxx+1))]*0x10000+ANSI2[s2i(SubString(s,eaxx+1,eaxx+2))]*0x100+ANSI2[s2i(SubString(s,eaxx+2,eaxx+3))]
endfunction
function ASC2I2 takes string s,integer min returns integer
set esx=s
set eaxx=min
call ExecuteFunc("ASC2IExec2")
return eax
endfunction
function GetIntBitwiseBR takes string STR,integer a,integer b returns integer
local integer bc=b
local integer m=1
local integer t=0
local string s=null
loop
exitwhen bc<=a
set s=SubString(STR,bc-1,bc)
set t=t+(S2I(s)*m)
if s=="-" then
set t=t*(-1)
endif
set m=m*10
set bc=bc-1
endloop
return t
endfunction
function GetRealBitwiseBR takes string STR,integer a,integer b returns real
local integer bc=b
local real m=1.0
local real t=0.0
local real t2=0.0
local string s=null
loop
exitwhen bc<=a
set s=SubString(STR,bc-1,bc)
if s=="-" then
set t=t*(-1.0)
set t2=t2*(-1.0)
elseif s=="." then
set t2=t/(m)
set bc=bc-1
set s=SubString(STR,bc-1,bc)
set m=1.0
set t=0.0
endif
set t=t+(S2R(s)*m)
set m=m*10.0
set bc=bc-1
endloop
set t=t+t2
return t
endfunction
я извеняюсь что некоторое "непонятно" написано но вообще это просто как бы для размышления =)
ну или подсмотреть что нить там ;)
Отредактировано Toadcop, 06.01.2008 в 02:37.
|