From owner-cvs-all Sun Dec 19 11:27:36 1999 Delivered-To: cvs-all@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 1F1B1151B9; Sun, 19 Dec 1999 11:27:32 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id LAA06641; Sun, 19 Dec 1999 11:27:19 -0800 (PST) (envelope-from dillon) Date: Sun, 19 Dec 1999 11:27:19 -0800 (PST) From: Matthew Dillon Message-Id: <199912191927.LAA06641@apollo.backplane.com> To: Bruce Evans Cc: Andrew Gallatin , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/nfs nfs_serv.c References: Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk : :On Wed, 15 Dec 1999, Andrew Gallatin wrote: : :> How about casting to a vm_offset_t? : :> Index: nfs_serv.c :> =================================================================== :> RCS file: /home/ncvs/src/sys/nfs/nfs_serv.c,v :> retrieving revision 1.90 :> diff -u -r1.90 nfs_serv.c :> --- nfs_serv.c 1999/12/13 17:34:45 1.90 :> +++ nfs_serv.c 1999/12/15 13:59:31 :> @@ -871,7 +871,7 @@ :> * Locate best candidate :> */ :> :> - hi = ((int)vp / sizeof(struct vnode)) & (NUM_HEURISTIC - 1); :> + hi = ((vm_offset_t)vp / sizeof(struct vnode)) & (NUM_HEURISTIC - 1); :> nh = &nfsheur[hi]; :> :> while (try--) { : :For C9x conformance, you have to cast the pointer to void * first, then to :intptr_t or uintptr_t. Many hash functions already do the latter. Most :get it wrong by omitting the cast to void *. : :For bug for bug compatibility, you have to cast eventually to a signed int. :If this is not done, then differences due to sign extension occur when :size_t is smaller than int, and pessimizations occur when vm_offset_t is :larger than size_t. : :For KNF conformance, lines must be no longer than 80 characters. : :Bruce Well, as long as the conversion is consistent I don't really care what numerical value it translates to. Plus we mask it with a relatively low number so we don't care about sign either. And I don't know of a single cpu that FreeBSD compiles on (or might compile on) that makes a distinction in the numerical value cast from a void * verses another type of pointer. If you want to 'fix' it please be my guest, I don't have any active patchsets associated with nfs_serv.c at the moment. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message