mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-07-21 10:28:50 +08:00
change instruction dispatch to computed-goto
bug fixed prepare for version 7.0
This commit is contained in:
+2
-8
@@ -15,10 +15,7 @@ var list=func()
|
||||
_.end=tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
_.begin=tmp;
|
||||
_.end=tmp;
|
||||
}
|
||||
_.begin=_.end=tmp;
|
||||
return;
|
||||
},
|
||||
push_front:func(elem)
|
||||
@@ -31,10 +28,7 @@ var list=func()
|
||||
_.begin=tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
_.begin=tmp;
|
||||
_.end=tmp;
|
||||
}
|
||||
_.begin=_.end=tmp;
|
||||
return;
|
||||
},
|
||||
pop_back:func()
|
||||
|
||||
+3
-10
@@ -3,9 +3,7 @@
|
||||
var sort=func(vec,left,right,cmp=func(a,b){return a<=b;})
|
||||
{
|
||||
if(left>=right) return nil;
|
||||
var L=left;
|
||||
var R=right;
|
||||
var tmp=vec[L];
|
||||
var (L,R,tmp)=(left,right,vec[left]);
|
||||
while(left<right)
|
||||
{
|
||||
while(left<right and cmp(tmp,vec[right]))
|
||||
@@ -13,14 +11,9 @@ var sort=func(vec,left,right,cmp=func(a,b){return a<=b;})
|
||||
while(left<right and cmp(vec[left],tmp))
|
||||
left+=1;
|
||||
if(left!=right)
|
||||
{
|
||||
var t=vec[left];
|
||||
vec[left]=vec[right];
|
||||
vec[right]=t;
|
||||
}
|
||||
(vec[left],vec[right])=(vec[right],vec[left]);
|
||||
}
|
||||
vec[L]=vec[left];
|
||||
vec[left]=tmp;
|
||||
(vec[L],vec[left])=(vec[left],tmp);
|
||||
sort(vec,L,left-1,cmp);
|
||||
sort(vec,left+1,R,cmp);
|
||||
return nil;
|
||||
|
||||
Reference in New Issue
Block a user