Merge branch 'master' of git://factorcode.org/git/factor
commit
0730f3a149
|
@ -230,9 +230,9 @@ T{ book
|
||||||
} book set
|
} book set
|
||||||
""" }
|
""" }
|
||||||
"Now we've created a book. Let's save it to the database."
|
"Now we've created a book. Let's save it to the database."
|
||||||
{ $code """USING: db db.sqlite fry io.files ;
|
{ $code """USING: db db.sqlite fry io.files.temp ;
|
||||||
: with-book-tutorial ( quot -- )
|
: with-book-tutorial ( quot -- )
|
||||||
'[ "book-tutorial.db" temp-file <sqlite-db> _ with-db ] call ;
|
'[ "book-tutorial.db" temp-file <sqlite-db> _ with-db ] call ; inline
|
||||||
|
|
||||||
[
|
[
|
||||||
book recreate-table
|
book recreate-table
|
||||||
|
|
|
@ -209,11 +209,13 @@ HELP: vbitxor
|
||||||
|
|
||||||
HELP: vlshift
|
HELP: vlshift
|
||||||
{ $values { "u" "a sequence of integers" } { "n" "a non-negative integer" } { "w" "a sequence of integers" } }
|
{ $values { "u" "a sequence of integers" } { "n" "a non-negative integer" } { "w" "a sequence of integers" } }
|
||||||
{ $description "Shifts each element of " { $snippet "u" } " to the left by " { $snippet "n" } " bits." } ;
|
{ $description "Shifts each element of " { $snippet "u" } " to the left by " { $snippet "n" } " bits." }
|
||||||
|
{ $notes "Undefined behavior will result if " { $snippet "n" } " is negative." } ;
|
||||||
|
|
||||||
HELP: vrshift
|
HELP: vrshift
|
||||||
{ $values { "u" "a sequence of integers" } { "n" "a non-negative integer" } { "w" "a sequence of integers" } }
|
{ $values { "u" "a sequence of integers" } { "n" "a non-negative integer" } { "w" "a sequence of integers" } }
|
||||||
{ $description "Shifts each element of " { $snippet "u" } " to the right by " { $snippet "n" } " bits." } ;
|
{ $description "Shifts each element of " { $snippet "u" } " to the right by " { $snippet "n" } " bits." }
|
||||||
|
{ $notes "Undefined behavior will result if " { $snippet "n" } " is negative." } ;
|
||||||
|
|
||||||
HELP: norm-sq
|
HELP: norm-sq
|
||||||
{ $values { "v" "a sequence of numbers" } { "x" "a non-negative real number" } }
|
{ $values { "v" "a sequence of numbers" } { "x" "a non-negative real number" } }
|
||||||
|
|
|
@ -24,11 +24,3 @@ SPECIALIZED-ARRAY: int
|
||||||
[ { 0 3 2 5 4 } ] [ { 1 2 3 4 5 } { 1 1 1 1 1 } v+- ] unit-test
|
[ { 0 3 2 5 4 } ] [ { 1 2 3 4 5 } { 1 1 1 1 1 } v+- ] unit-test
|
||||||
|
|
||||||
[ 1 ] [ { C{ 0 1 } } dup v. ] unit-test
|
[ 1 ] [ { C{ 0 1 } } dup v. ] unit-test
|
||||||
|
|
||||||
! Make sure vector shifts behave the same as hardware SIMD vector shifts
|
|
||||||
[ int-array{ 0 0 0 0 } ] [ int-array{ 10 20 30 40 } -1 vlshift ] unit-test
|
|
||||||
|
|
||||||
[ int-array{ 0 0 0 0 } ] [
|
|
||||||
int-array{ 10 20 30 40 }
|
|
||||||
[ { int-array } declare -1 vlshift ] compile-call
|
|
||||||
] unit-test
|
|
|
@ -61,8 +61,8 @@ PRIVATE>
|
||||||
: vbitor ( u v -- w ) over '[ _ [ bitor ] fp-bitwise-op ] 2map ;
|
: vbitor ( u v -- w ) over '[ _ [ bitor ] fp-bitwise-op ] 2map ;
|
||||||
: vbitxor ( u v -- w ) over '[ _ [ bitxor ] fp-bitwise-op ] 2map ;
|
: vbitxor ( u v -- w ) over '[ _ [ bitxor ] fp-bitwise-op ] 2map ;
|
||||||
|
|
||||||
: vlshift ( u n -- w ) HEX: ffffffff bitand '[ _ shift ] map ;
|
: vlshift ( u n -- w ) '[ _ shift ] map ;
|
||||||
: vrshift ( u n -- w ) HEX: ffffffff bitand neg '[ _ shift ] map ;
|
: vrshift ( u n -- w ) neg '[ _ shift ] map ;
|
||||||
|
|
||||||
: vfloor ( u -- v ) [ floor ] map ;
|
: vfloor ( u -- v ) [ floor ] map ;
|
||||||
: vceiling ( u -- v ) [ ceiling ] map ;
|
: vceiling ( u -- v ) [ ceiling ] map ;
|
||||||
|
|
|
@ -126,10 +126,15 @@ segment::~segment()
|
||||||
SYSTEM_INFO si;
|
SYSTEM_INFO si;
|
||||||
GetSystemInfo(&si);
|
GetSystemInfo(&si);
|
||||||
if(!VirtualFree((void*)(start - si.dwPageSize), 0, MEM_RELEASE))
|
if(!VirtualFree((void*)(start - si.dwPageSize), 0, MEM_RELEASE))
|
||||||
myvm->fatal_error("Segment deallocation failed",0);
|
fatal_error("Segment deallocation failed",0);
|
||||||
}
|
}
|
||||||
|
|
||||||
long factor_vm::getpagesize()
|
void factor_vm::sleep_micros(u64 usec)
|
||||||
|
{
|
||||||
|
Sleep((DWORD)(usec / 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
long getpagesize()
|
||||||
{
|
{
|
||||||
static long g_pagesize = 0;
|
static long g_pagesize = 0;
|
||||||
if (! g_pagesize)
|
if (! g_pagesize)
|
||||||
|
@ -141,9 +146,4 @@ long factor_vm::getpagesize()
|
||||||
return g_pagesize;
|
return g_pagesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void factor_vm::sleep_micros(u64 usec)
|
|
||||||
{
|
|
||||||
Sleep((DWORD)(usec / 1000));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,5 +45,6 @@ inline static void init_signals() {}
|
||||||
inline static void early_init() {}
|
inline static void early_init() {}
|
||||||
|
|
||||||
s64 current_micros();
|
s64 current_micros();
|
||||||
|
long getpagesize();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,7 +559,6 @@ struct factor_vm : factor_vm_data {
|
||||||
// os-windows
|
// os-windows
|
||||||
#if defined(WINDOWS)
|
#if defined(WINDOWS)
|
||||||
void sleep_micros(u64 usec);
|
void sleep_micros(u64 usec);
|
||||||
long getpagesize();
|
|
||||||
const vm_char *vm_executable_path();
|
const vm_char *vm_executable_path();
|
||||||
const vm_char *default_image_path();
|
const vm_char *default_image_path();
|
||||||
void windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length);
|
void windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length);
|
||||||
|
|
Loading…
Reference in New Issue