From 3672bf1431b349b4554d4cf73c4b8d10c6d1a9be Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 15 May 1987 18:20:45 +0000 Subject: [PATCH] Implement new primitive `string-hash-mod' to enable efficient string/symbol hashed tables to be implemented in Scheme. --- v7/src/microcode/intern.c | 14 ++++++++++++-- v7/src/microcode/utabmd.scm | 6 +++--- v7/src/microcode/version.h | 4 ++-- v8/src/microcode/utabmd.scm | 6 +++--- v8/src/microcode/version.h | 4 ++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/v7/src/microcode/intern.c b/v7/src/microcode/intern.c index 639d44850..130881a6b 100644 --- a/v7/src/microcode/intern.c +++ b/v7/src/microcode/intern.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/intern.c,v 9.40 1987/05/11 17:52:27 cph Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/intern.c,v 9.41 1987/05/15 18:19:45 cph Rel $ Utilities for manipulating symbols. */ @@ -241,7 +241,7 @@ Built_In_Primitive(Prim_Intern_Character_List, 1, return string_to_symbol(list_to_string(Arg1)); } - + /* (STRING-HASH STRING) Return a hash value for a string. This uses the hashing algorithm used for interning symbols. It is intended for use by @@ -255,6 +255,16 @@ Built_In_Primitive(Prim_String_Hash, 1, "STRING-HASH", 0x83) return Hash(Arg1); } +Built_In_Primitive (Prim_string_hash_mod, 2, "STRING-HASH-MOD", 0x8A) +{ + Primitive_2_Args (); + CHECK_ARG (1, STRING_P); + + return + (MAKE_UNSIGNED_FIXNUM + ((scheme_string_hash (Arg1)) % (arg_nonnegative_integer (2)))); +} + /* (CHARACTER-LIST-HASH LIST) Takes a list of ASCII codes for characters and returns a hash code for them. This uses the hashing function used to intern diff --git a/v7/src/microcode/utabmd.scm b/v7/src/microcode/utabmd.scm index 476321fca..93c1f961b 100644 --- a/v7/src/microcode/utabmd.scm +++ b/v7/src/microcode/utabmd.scm @@ -37,7 +37,7 @@ ;;;; Machine Dependent Type Tables -;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/utabmd.scm,v 9.27 1987/04/29 13:19:32 cph Exp $ +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/utabmd.scm,v 9.28 1987/05/15 18:20:45 cph Exp $ (declare (usual-integrations)) @@ -457,7 +457,7 @@ SYSTEM-PAIR-CDR ;$87 SYSTEM-PAIR-SET-CAR! ;$88 SYSTEM-PAIR-SET-CDR! ;$89 - #F ;$8A + STRING-HASH-MOD ;$8A #F ;$8B SET-CELL-CONTENTS! ;$8C &MAKE-OBJECT ;$8D @@ -854,4 +854,4 @@ ;;; This identification string is saved by the system. -"$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/utabmd.scm,v 9.27 1987/04/29 13:19:32 cph Exp $" +"$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/utabmd.scm,v 9.28 1987/05/15 18:20:45 cph Exp $" diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index d3291b892..a8e1efbe3 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 9.51 1987/05/14 13:51:20 cph Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 9.52 1987/05/15 18:20:28 cph Exp $ This file contains version information for the microcode. */ @@ -46,7 +46,7 @@ This file contains version information for the microcode. */ #define VERSION 9 #endif #ifndef SUBVERSION -#define SUBVERSION 51 +#define SUBVERSION 52 #endif #ifndef UCODE_TABLES_FILENAME diff --git a/v8/src/microcode/utabmd.scm b/v8/src/microcode/utabmd.scm index 880a4b639..00797b7b9 100644 --- a/v8/src/microcode/utabmd.scm +++ b/v8/src/microcode/utabmd.scm @@ -37,7 +37,7 @@ ;;;; Machine Dependent Type Tables -;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/utabmd.scm,v 9.27 1987/04/29 13:19:32 cph Exp $ +;;; $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/utabmd.scm,v 9.28 1987/05/15 18:20:45 cph Exp $ (declare (usual-integrations)) @@ -457,7 +457,7 @@ SYSTEM-PAIR-CDR ;$87 SYSTEM-PAIR-SET-CAR! ;$88 SYSTEM-PAIR-SET-CDR! ;$89 - #F ;$8A + STRING-HASH-MOD ;$8A #F ;$8B SET-CELL-CONTENTS! ;$8C &MAKE-OBJECT ;$8D @@ -854,4 +854,4 @@ ;;; This identification string is saved by the system. -"$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/utabmd.scm,v 9.27 1987/04/29 13:19:32 cph Exp $" +"$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/utabmd.scm,v 9.28 1987/05/15 18:20:45 cph Exp $" diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index dccb9fb0c..492a5e800 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 9.51 1987/05/14 13:51:20 cph Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 9.52 1987/05/15 18:20:28 cph Exp $ This file contains version information for the microcode. */ @@ -46,7 +46,7 @@ This file contains version information for the microcode. */ #define VERSION 9 #endif #ifndef SUBVERSION -#define SUBVERSION 51 +#define SUBVERSION 52 #endif #ifndef UCODE_TABLES_FILENAME -- 2.25.1