Date: Sun, 19 Dec 1999 11:27:19 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: Bruce Evans <bde@zeta.org.au> Cc: Andrew Gallatin <gallatin@cs.duke.edu>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/nfs nfs_serv.c Message-ID: <199912191927.LAA06641@apollo.backplane.com> References: <Pine.BSF.4.10.9912192119560.6992-100000@alphplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
: :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 <dillon@backplane.com> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912191927.LAA06641>