Date: Sun, 22 Aug 1999 20:06:56 +0900 From: "Daniel C. Sobral" <dcs@newsguy.com> To: John-Mark Gurney <gurney_j@resnet.uoregon.edu> Cc: Mark Murray <mark@grondar.za>, Nick Hibma <hibma@skylink.it>, FreeBSD Hackers mailing list <hackers@FreeBSD.ORG> Subject: Re: from number to power of two Message-ID: <37BFD9D0.D330B565@newsguy.com> References: <199908220750.JAA69064@gratis.grondar.za> <19990822010157.02195@hydrogen.fircrest.net>
next in thread | previous in thread | raw e-mail | index | archive | help
John-Mark Gurney wrote: > > > Shift a bit until it becomes greater than (or less than) the number > > in question. > > ummm, didn't you read his post?? he wanted a O(1) routine, NOT a O(n) > routine... That technique is O(ln(n)), where n is the number in question. Frankly, for numbers up to 32, a table will wield the best results, and might actually be smaller than some of the suggestions given so far. -- Daniel C. Sobral (8-DCS) dcs@newsguy.com dcs@freebsd.org - Come on. - Where are we going? - To get what you came for. - What's that? - Me. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37BFD9D0.D330B565>