string hashing kludge; amd64 cpu detection
parent
1f418a7e60
commit
4435110231
|
@ -25,11 +25,11 @@ t [
|
|||
"/library/alien/malloc.factor"
|
||||
"/library/io/buffer.factor"
|
||||
|
||||
"/library/sdl/load.factor"
|
||||
"/library/opengl/load.factor"
|
||||
"/library/freetype/load.factor"
|
||||
"/library/ui/load.factor"
|
||||
"/library/help/load.factor"
|
||||
! "/library/sdl/load.factor"
|
||||
! "/library/opengl/load.factor"
|
||||
! "/library/freetype/load.factor"
|
||||
! "/library/ui/load.factor"
|
||||
! "/library/help/load.factor"
|
||||
] pull-in
|
||||
|
||||
! Handle -libraries:... overrides
|
||||
|
|
|
@ -20,6 +20,10 @@ void init_factor(char* image, CELL ds_size, CELL cs_size,
|
|||
userenv[OS_ENV] = tag_object(from_c_string(FACTOR_OS_STRING));
|
||||
userenv[GEN_ENV] = tag_fixnum(gen_count);
|
||||
userenv[CARD_OFF_ENV] = tag_cell(cards_offset);
|
||||
userenv[IMAGE_ENV] = tag_object(from_c_string(image));
|
||||
userenv[CELL_SIZE_ENV] = tag_fixnum(sizeof(CELL));
|
||||
userenv[INT_SIZE_ENV] = tag_fixnum(sizeof(int));
|
||||
userenv[LONG_SIZE_ENV] = tag_fixnum(sizeof(long));
|
||||
}
|
||||
|
||||
INLINE bool factor_arg(const char* str, const char* arg, CELL* value)
|
||||
|
@ -98,7 +102,6 @@ int main(int argc, char** argv)
|
|||
args = cons(tag_object(from_c_string(argv[argc])),args);
|
||||
}
|
||||
|
||||
userenv[IMAGE_ENV] = tag_object(from_c_string(image));
|
||||
userenv[ARGS_ENV] = args;
|
||||
|
||||
platform_run();
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#define FACTOR_X86
|
||||
#elif defined(__POWERPC__) || defined(__ppc__) || defined(_ARCH_PPC)
|
||||
#define FACTOR_PPC
|
||||
#elif defined(__amd64__) || defined(__x86_64__)
|
||||
#define FACTOR_AMD64
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
@ -15,6 +17,8 @@
|
|||
#define FACTOR_CPU_STRING "x86"
|
||||
#elif defined(FACTOR_PPC)
|
||||
#define FACTOR_CPU_STRING "ppc"
|
||||
#elif defined(FACTOR_AMD64)
|
||||
#define FACTOR_CPU_STRING "amd64"
|
||||
#else
|
||||
#define FACTOR_CPU_STRING "unknown"
|
||||
#endif
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
#define OUT_ENV 14
|
||||
#define GEN_ENV 15 /* set to gen_count */
|
||||
#define IMAGE_ENV 16 /* image name */
|
||||
#define CELL_SIZE_ENV 17 /* sizeof(CELL) */
|
||||
#define INT_SIZE_ENV 18 /* sizeof(int) */
|
||||
#define LONG_SIZE_ENV 19 /* sizeof(long) */
|
||||
|
||||
/* TAGGED user environment data; see getenv/setenv prims */
|
||||
DLLEXPORT CELL userenv[USER_ENV];
|
||||
|
|
|
@ -17,12 +17,12 @@ F_STRING* allot_string(CELL capacity)
|
|||
/* call this after constructing a string */
|
||||
void rehash_string(F_STRING* str)
|
||||
{
|
||||
F_FIXNUM hash = 0;
|
||||
s32 hash = 0;
|
||||
CELL i;
|
||||
CELL capacity = string_capacity(str);
|
||||
for(i = 0; i < capacity; i++)
|
||||
hash = 31*hash + string_nth(str,i);
|
||||
str->hashcode = tag_fixnum(hash);
|
||||
hash = (31*hash + string_nth(str,i));
|
||||
str->hashcode = (s32)tag_fixnum(hash);
|
||||
}
|
||||
|
||||
void primitive_rehash_string(void)
|
||||
|
|
Loading…
Reference in New Issue