more LP64 friendly.
To: None <tech-kern@NetBSD.org>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 11/23/2003 09:31:20
This time I'll include the diff:
Index: tree.h
===================================================================
RCS file: /cvsroot/src/sys/sys/tree.h,v
retrieving revision 1.6
diff -c -3 -p -r1.6 tree.h
*** tree.h 3 Nov 2003 04:20:28 -0000 1.6
--- tree.h 23 Nov 2003 17:17:44 -0000
*************** struct { \
*** 113,126 ****
/* Generates prototypes and inline functions */
#define SPLAY_PROTOTYPE(name, type, field, cmp) \
! void name##_SPLAY(struct name *, struct type *); \
! void name##_SPLAY_MINMAX(struct name *, int); \
struct type *name##_SPLAY_INSERT(struct name *, struct type *); \
struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \
\
/* Finds the node with the same key as elm */ \
static __inline struct type * \
! name##_SPLAY_FIND(struct name *head, struct type *elm) \
{ \
if (SPLAY_EMPTY(head)) \
return(NULL); \
--- 113,126 ----
/* Generates prototypes and inline functions */
#define SPLAY_PROTOTYPE(name, type, field, cmp) \
! void name##_SPLAY(struct name *, const struct type *); \
! void name##_SPLAY_MINMAX(struct name *, long); \
struct type *name##_SPLAY_INSERT(struct name *, struct type *); \
struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \
\
/* Finds the node with the same key as elm */ \
static __inline struct type * \
! name##_SPLAY_FIND(struct name *head, const struct type *elm) \
{ \
if (SPLAY_EMPTY(head)) \
return(NULL); \
*************** name##_SPLAY_NEXT(struct name *head, str
*** 145,151 ****
} \
\
static __inline struct type * \
! name##_SPLAY_MIN_MAX(struct name *head, int val) \
{ \
name##_SPLAY_MINMAX(head, val); \
return (SPLAY_ROOT(head)); \
--- 145,151 ----
} \
\
static __inline struct type * \
! name##_SPLAY_MIN_MAX(struct name *head, long val) \
{ \
name##_SPLAY_MINMAX(head, val); \
return (SPLAY_ROOT(head)); \
*************** name##_SPLAY_INSERT(struct name *head, s
*** 161,167 ****
if (SPLAY_EMPTY(head)) { \
SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \
} else { \
! int __comp; \
name##_SPLAY(head, elm); \
__comp = (cmp)(elm, (head)->sph_root); \
if(__comp < 0) { \
--- 161,167 ----
if (SPLAY_EMPTY(head)) { \
SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \
} else { \
! long __comp; \
name##_SPLAY(head, elm); \
__comp = (cmp)(elm, (head)->sph_root); \
if(__comp < 0) { \
*************** name##_SPLAY_REMOVE(struct name *head, s
*** 201,210 ****
} \
\
void \
! name##_SPLAY(struct name *head, struct type *elm) \
{ \
struct type __node, *__left, *__right, *__tmp; \
! int __comp; \
\
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
--- 201,210 ----
} \
\
void \
! name##_SPLAY(struct name *head, const struct type *elm) \
{ \
struct type __node, *__left, *__right, *__tmp; \
! long __comp; \
\
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
*************** name##_SPLAY(struct name *head, struct t
*** 238,244 ****
/* Splay with either the minimum or the maximum element \
* Used to find minimum or maximum element in tree. \
*/ \
! void name##_SPLAY_MINMAX(struct name *head, int __comp) \
{ \
struct type __node, *__left, *__right, *__tmp; \
\
--- 238,244 ----
/* Splay with either the minimum or the maximum element \
* Used to find minimum or maximum element in tree. \
*/ \
! void name##_SPLAY_MINMAX(struct name *head, long __comp) \
{ \
struct type __node, *__left, *__right, *__tmp; \
\
*************** void name##_SPLAY_MINMAX(struct name *he
*** 271,278 ****
SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
}
! #define SPLAY_NEGINF -1
! #define SPLAY_INF 1
#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y)
#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y)
--- 271,278 ----
SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
}
! #define SPLAY_NEGINF -1L
! #define SPLAY_INF 1L
#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y)
#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y)
*************** void name##_RB_INSERT_COLOR(struct name
*** 379,387 ****
void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type
*);\
struct type *name##_RB_REMOVE(struct name *, struct type *); \
struct type *name##_RB_INSERT(struct name *, struct type *); \
! struct type *name##_RB_FIND(struct name *, struct type *); \
struct type *name##_RB_NEXT(struct name *, struct type *); \
! struct type *name##_RB_MINMAX(struct name *, int); \
\
/* Main rb operation.
--- 379,387 ----
void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type
*);\
struct type *name##_RB_REMOVE(struct name *, struct type *); \
struct type *name##_RB_INSERT(struct name *, struct type *); \
! struct type *name##_RB_FIND(struct name *, const struct type *); \
struct type *name##_RB_NEXT(struct name *, struct type *); \
! struct type *name##_RB_MINMAX(struct name *, long); \
\
/* Main rb operation.
*************** name##_RB_INSERT(struct name *head, stru
*** 583,589 ****
{ \
struct type *tmp; \
struct type *parent = NULL; \
! int comp = 0; \
tmp = RB_ROOT(head); \
while (tmp) { \
parent = tmp; \
--- 583,589 ----
{ \
struct type *tmp; \
struct type *parent = NULL; \
! long comp = 0; \
tmp = RB_ROOT(head); \
while (tmp) { \
parent = tmp; \
*************** name##_RB_INSERT(struct name *head, stru
*** 610,619 ****
\
/* Finds the node with the same key as elm */ \
struct type * \
! name##_RB_FIND(struct name *head, struct type *elm) \
{ \
struct type *tmp = RB_ROOT(head); \
! int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) \
--- 610,619 ----
\
/* Finds the node with the same key as elm */ \
struct type * \
! name##_RB_FIND(struct name *head, const struct type *elm) \
{ \
struct type *tmp = RB_ROOT(head); \
! long comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) \
*************** name##_RB_NEXT(struct name *head, struct
*** 649,655 ****
} \
\
struct type * \
! name##_RB_MINMAX(struct name *head, int val) \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *parent = NULL; \
--- 649,655 ----
} \
\
struct type * \
! name##_RB_MINMAX(struct name *head, long val) \
{ \
struct type *tmp = RB_ROOT(head); \
struct type *parent = NULL; \