Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/auxiliary/guile_containers_rbmap.c b/auxiliary/guile_containers_rbmap.c
- index 0e696fc..33550ba 100644
- --- a/auxiliary/guile_containers_rbmap.c
- +++ b/auxiliary/guile_containers_rbmap.c
- @@ -32,7 +32,7 @@ INITIALIZED_CONSTANT (_FF_ATTRIBUTE_PURE static, SCM, _rbmapi_to_pointer,
- //-------------------------------------------------------------------------
- //
- -// Maps with intmax_t as keys.
- +// Maps with size_t as keys.
- typedef struct rbmapi_node_s rbmapi_node_t;
- @@ -76,7 +76,7 @@ scm_to_c_rbmapi (SCM map)
- }
- // Create instances of inline functions.
- -VISIBLE intmax_t scm_rbmapi_iter_key (scm_t_rbmapi_iter iter);
- +VISIBLE size_t scm_rbmapi_iter_key (scm_t_rbmapi_iter iter);
- VISIBLE SCM scm_rbmapi_iter_value (scm_t_rbmapi_iter iter);
- VISIBLE void scm_rbmapi_iter_set_value (scm_t_rbmapi_iter iter, SCM value);
- @@ -101,7 +101,7 @@ scm_c_rbmapi_nsearch (SCM map, SCM key)
- iter = (scm_t_rbmapi_iter) rbmapi_first (tree);
- else
- {
- - const intmax_t i_key = scm_to_intmax (key);
- + const size_t i_key = scm_to_size_t (key);
- rbmapi_node_t key_node = {.key = i_key };
- iter = (scm_t_rbmapi_iter) rbmapi_nsearch (tree, &key_node);
- }
- @@ -117,7 +117,7 @@ scm_c_rbmapi_psearch (SCM map, SCM key)
- iter = (scm_t_rbmapi_iter) rbmapi_last (tree);
- else
- {
- - const intmax_t i_key = scm_to_intmax (key);
- + const size_t i_key = scm_to_size_t (key);
- rbmapi_node_t key_node = {.key = i_key };
- iter = (scm_t_rbmapi_iter) rbmapi_psearch (tree, &key_node);
- }
- @@ -147,7 +147,7 @@ scm_make_rbmapi (void)
- }
- static inline void
- -internal_rbmapi_insert (rbmapi_t *tree, intmax_t i_key, SCM value)
- +internal_rbmapi_insert (rbmapi_t *tree, size_t i_key, SCM value)
- {
- rbmapi_node_t *node = scm_gc_malloc (sizeof (rbmapi_node_t), "rbmapi_node_t");
- node->key = i_key;
- @@ -159,7 +159,7 @@ VISIBLE SCM
- scm_rbmapi_set_x (SCM map, SCM key, SCM value)
- {
- rbmapi_t *tree = scm_to_c_rbmapi (map);
- - const intmax_t i_key = scm_to_intmax (key);
- + const size_t i_key = scm_to_size_t (key);
- rbmapi_node_t key_node = {.key = i_key };
- rbmapi_node_t *node = rbmapi_search (tree, &key_node);
- @@ -175,7 +175,7 @@ VISIBLE SCM
- scm_rbmapi_delete_x (SCM map, SCM key)
- {
- rbmapi_t *tree = scm_to_c_rbmapi (map);
- - const intmax_t i_key = scm_to_intmax (key);
- + const size_t i_key = scm_to_size_t (key);
- rbmapi_node_t key_node = {.key = i_key };
- rbmapi_node_t *node = rbmapi_search (tree, &key_node);
- @@ -192,7 +192,7 @@ scm_rbmapi_ref (SCM map, SCM key, SCM default_value)
- SCM dflt = SCM_UNBNDP (default_value) ? SCM_BOOL_F : default_value;
- rbmapi_t *tree = scm_to_c_rbmapi (map);
- - const intmax_t i_key = scm_to_intmax (key);
- + const size_t i_key = scm_to_size_t (key);
- rbmapi_node_t key_node = {.key = i_key };
- const rbmapi_node_t *node = rbmapi_search (tree, &key_node);
- @@ -206,7 +206,7 @@ scm_rbmapi_fold_left (SCM proc, SCM init, SCM map, SCM start_key)
- for (scm_t_rbmapi_iter p = scm_c_rbmapi_nsearch (map, start_key); p != NULL;
- p = scm_c_rbmapi_next (map, p))
- init =
- - scm_call_3 (proc, init, scm_from_intmax (scm_rbmapi_iter_key (p)),
- + scm_call_3 (proc, init, scm_from_size_t (scm_rbmapi_iter_key (p)),
- scm_rbmapi_iter_value (p));
- return init;
- }
- @@ -217,7 +217,7 @@ scm_rbmapi_fold_right (SCM proc, SCM init, SCM map, SCM start_key)
- for (scm_t_rbmapi_iter p = scm_c_rbmapi_psearch (map, start_key); p != NULL;
- p = scm_c_rbmapi_prev (map, p))
- init =
- - scm_call_3 (proc, scm_from_intmax (scm_rbmapi_iter_key (p)),
- + scm_call_3 (proc, scm_from_size_t (scm_rbmapi_iter_key (p)),
- scm_rbmapi_iter_value (p), init);
- return init;
- }
- @@ -242,7 +242,7 @@ scm_rbmapi_to_alist (SCM map)
- // Go backwards, so consing preserves the order.
- for (scm_t_rbmapi_iter p = scm_c_rbmapi_last (map); p != NULL;
- p = scm_c_rbmapi_prev (map, p))
- - alist = scm_acons (scm_from_intmax (scm_rbmapi_iter_key (p)),
- + alist = scm_acons (scm_from_size_t (scm_rbmapi_iter_key (p)),
- scm_rbmapi_iter_value (p), alist);
- return alist;
- @@ -257,7 +257,7 @@ scm_rbmapi_map_to_list (SCM proc, SCM map)
- for (scm_t_rbmapi_iter p = scm_c_rbmapi_last (map); p != NULL;
- p = scm_c_rbmapi_prev (map, p))
- {
- - SCM element = scm_call_2 (proc, scm_from_intmax (scm_rbmapi_iter_key (p)),
- + SCM element = scm_call_2 (proc, scm_from_size_t (scm_rbmapi_iter_key (p)),
- scm_rbmapi_iter_value (p));
- lst = scm_cons (element, lst);
- }
- @@ -270,7 +270,7 @@ scm_rbmapi_for_each (SCM proc, SCM map)
- {
- for (scm_t_rbmapi_iter p = scm_c_rbmapi_last (map); p != NULL;
- p = scm_c_rbmapi_prev (map, p))
- - scm_call_2 (proc, scm_from_intmax (scm_rbmapi_iter_key (p)),
- + scm_call_2 (proc, scm_from_size_t (scm_rbmapi_iter_key (p)),
- scm_rbmapi_iter_value (p));
- return SCM_UNSPECIFIED;
- }
- @@ -282,7 +282,7 @@ scm_rbmapi_count (SCM pred, SCM map)
- for (scm_t_rbmapi_iter p = scm_c_rbmapi_first (map); p != NULL;
- p = scm_c_rbmapi_next (map, p))
- if (scm_is_true
- - (scm_call_2 (pred, scm_from_intmax (scm_rbmapi_iter_key (p)),
- + (scm_call_2 (pred, scm_from_size_t (scm_rbmapi_iter_key (p)),
- scm_rbmapi_iter_value (p))))
- count = scm_oneplus (count);
- return count;
- diff --git a/inc/sortsmill/guile/containers/rbmap.h b/inc/sortsmill/guile/containers/rbmap.h
- index 0c7ccd8..f479cec 100644
- --- a/inc/sortsmill/guile/containers/rbmap.h
- +++ b/inc/sortsmill/guile/containers/rbmap.h
- @@ -29,7 +29,7 @@ extern "C"
- }
- #endif
- -#define SCM_RBMAPI_NODE_HEAD intmax_t key; SCM value
- +#define SCM_RBMAPI_NODE_HEAD size_t key; SCM value
- typedef struct
- {
- @@ -38,7 +38,7 @@ typedef struct
- typedef scm_t_rbmapi_node_data *scm_t_rbmapi_iter;
- -inline intmax_t scm_rbmapi_iter_key (scm_t_rbmapi_iter iter);
- +inline size_t scm_rbmapi_iter_key (scm_t_rbmapi_iter iter);
- inline SCM scm_rbmapi_iter_value (scm_t_rbmapi_iter iter);
- inline void scm_rbmapi_iter_set_value (scm_t_rbmapi_iter iter, SCM value);
- @@ -62,7 +62,7 @@ SCM scm_rbmapi_for_each (SCM proc, SCM map);
- SCM scm_rbmapi_count (SCM pred, SCM map);
- SCM scm_rbmapi_size (SCM map);
- -inline intmax_t
- +inline size_t
- scm_rbmapi_iter_key (scm_t_rbmapi_iter iter)
- {
- return iter->key;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement