[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] branch master updated: Implement hashing for keywords, i
From: |
Rob Browning |
Subject: |
[Guile-commits] branch master updated: Implement hashing for keywords, i.e. (hash #:x ...) |
Date: |
Fri, 21 Feb 2020 02:43:51 -0500 |
This is an automated email from the git hooks/post-receive script.
rlb pushed a commit to branch master
in repository guile.
The following commit(s) were added to refs/heads/master by this push:
new 8b3cad6 Implement hashing for keywords, i.e. (hash #:x ...)
8b3cad6 is described below
commit 8b3cad618314f02ad3921fa104f17ca0f721dfcb
Author: Rob Browning <address@hidden>
AuthorDate: Sun Feb 16 12:12:08 2020 -0600
Implement hashing for keywords, i.e. (hash #:x ...)
Add keyword handling to (hash ...). Previously it would just return the
same value for all keywords.
* libguile/hash.c (scm_raw_ihash): Add scm_tc7_keyword case.
* libguile/keywords.h (SCM_I_KEYWORD_HASH): New macro.
---
libguile/hash.c | 3 +++
libguile/keywords.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/libguile/hash.c b/libguile/hash.c
index d6e93da..c51a794 100644
--- a/libguile/hash.c
+++ b/libguile/hash.c
@@ -35,6 +35,7 @@
#include "chars.h"
#include "foreign.h"
#include "gsubr.h"
+#include "keywords.h"
#include "numbers.h"
#include "pairs.h"
#include "ports.h"
@@ -307,6 +308,8 @@ scm_raw_ihash (SCM obj, size_t depth)
return scm_i_string_hash (obj);
case scm_tc7_symbol:
return scm_i_symbol_hash (obj);
+ case scm_tc7_keyword:
+ return SCM_I_KEYWORD_HASH (obj);
case scm_tc7_pointer:
return scm_raw_ihashq ((uintptr_t) SCM_POINTER_VALUE (obj));
case scm_tc7_wvect:
diff --git a/libguile/keywords.h b/libguile/keywords.h
index c8f4808..cb8598d 100644
--- a/libguile/keywords.h
+++ b/libguile/keywords.h
@@ -60,6 +60,8 @@ SCM_API void
scm_c_bind_keyword_arguments (const char *subr, SCM rest,
scm_t_keyword_arguments_flags flags, ...);
+#define SCM_I_KEYWORD_HASH(x) scm_i_symbol_hash (SCM_CELL_OBJECT_1 (x))
+
SCM_INTERNAL void scm_init_keywords (void);
#endif /* SCM_KEYWORDS_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] branch master updated: Implement hashing for keywords, i.e. (hash #:x ...),
Rob Browning <=