📝 optimize code
This commit is contained in:
parent
eab84d5c0d
commit
94b6e84693
|
@ -29,7 +29,7 @@ var quick_fib(var* args, usize size, gc* ngc) {
|
||||||
return var::num(num);
|
return var::num(num);
|
||||||
}
|
}
|
||||||
double a = 1, b = 1, res = 0;
|
double a = 1, b = 1, res = 0;
|
||||||
for(double i=1;i<num;i+=1) {
|
for(double i = 1; i<num; ++i) {
|
||||||
res = a+b;
|
res = a+b;
|
||||||
a = b;
|
a = b;
|
||||||
b = res;
|
b = res;
|
||||||
|
@ -71,7 +71,8 @@ var print_new_ghost(var* args, usize size, gc* ngc) {
|
||||||
std::cout << "print_new_ghost: not ghost for test type.\n";
|
std::cout << "print_new_ghost: not ghost for test type.\n";
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
std::cout<<"print_new_ghost: "<<res.obj()<<" result = "<<*((u32*)res.obj().ptr)<<"\n";
|
std::cout << "print_new_ghost: " << res.obj() << " result = "
|
||||||
|
<< *((u32*)res.obj().ptr) << "\n";
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include "nasal_import.h"
|
#include "nasal_import.h"
|
||||||
|
|
||||||
linker::linker(error& e): show_path(false), lib_loaded(false), err(e) {
|
linker::linker(error& e):
|
||||||
|
show_path(false), lib_loaded(false), err(e) {
|
||||||
char sep = is_windows()? ';':':';
|
char sep = is_windows()? ';':':';
|
||||||
std::string PATH = getenv("PATH");
|
std::string PATH = getenv("PATH");
|
||||||
usize last=0;
|
usize last = 0, pos = PATH.find(sep, 0);
|
||||||
usize pos=PATH.find(sep, 0);
|
|
||||||
while(pos!=std::string::npos) {
|
while(pos!=std::string::npos) {
|
||||||
std::string dirpath = PATH.substr(last, pos-last);
|
std::string dirpath = PATH.substr(last, pos-last);
|
||||||
if (dirpath.length()) {
|
if (dirpath.length()) {
|
||||||
|
|
Loading…
Reference in New Issue