svn commit: r295031 - head/lib/libc/db/hash

Brooks Davis brooks at FreeBSD.org
Fri Jan 29 01:22:14 UTC 2016


Author: brooks
Date: Fri Jan 29 01:22:12 2016
New Revision: 295031
URL: https://svnweb.freebsd.org/changeset/base/295031

Log:
  Use intptr_t note ptrdiff_t when storing flags in the bottom bits of
  pointers.
  
  Obtained from:	CheriBSD (e3a69027cc5a384431156d61c90d4304387a9b9d)
  Sponsored by:	DARPA, AFRL

Modified:
  head/lib/libc/db/hash/hash.h
  head/lib/libc/db/hash/hash_buf.c

Modified: head/lib/libc/db/hash/hash.h
==============================================================================
--- head/lib/libc/db/hash/hash.h	Fri Jan 29 01:09:04 2016	(r295030)
+++ head/lib/libc/db/hash/hash.h	Fri Jan 29 01:22:12 2016	(r295031)
@@ -138,11 +138,11 @@ typedef struct htab	 {		/* Memory reside
 #define ALL_SET			((u_int32_t)0xFFFFFFFF)
 #define ALL_CLEAR		0
 
-#define PTROF(X)	((BUFHEAD *)((ptrdiff_t)(X)&~0x3))
-#define ISMOD(X)	((u_int32_t)(ptrdiff_t)(X)&0x1)
-#define DOMOD(X)	((X) = (char *)((ptrdiff_t)(X)|0x1))
-#define ISDISK(X)	((u_int32_t)(ptrdiff_t)(X)&0x2)
-#define DODISK(X)	((X) = (char *)((ptrdiff_t)(X)|0x2))
+#define PTROF(X)	((BUFHEAD *)((intptr_t)(X)&~0x3))
+#define ISMOD(X)	((u_int32_t)(intptr_t)(X)&0x1)
+#define DOMOD(X)	((X) = (char *)((intptr_t)(X)|0x1))
+#define ISDISK(X)	((u_int32_t)(intptr_t)(X)&0x2)
+#define DODISK(X)	((X) = (char *)((intptr_t)(X)|0x2))
 
 #define BITS_PER_MAP	32
 

Modified: head/lib/libc/db/hash/hash_buf.c
==============================================================================
--- head/lib/libc/db/hash/hash_buf.c	Fri Jan 29 01:09:04 2016	(r295030)
+++ head/lib/libc/db/hash/hash_buf.c	Fri Jan 29 01:22:12 2016	(r295031)
@@ -138,7 +138,7 @@ __get_buf(HTAB *hashp, u_int32_t addr,
 			return (NULL);
 		if (!prev_bp)
 			segp[segment_ndx] =
-			    (BUFHEAD *)((ptrdiff_t)bp | is_disk_mask);
+			    (BUFHEAD *)((intptr_t)bp | is_disk_mask);
 	} else {
 		BUF_REMOVE(bp);
 		MRU_INSERT(bp);


More information about the svn-src-head mailing list