Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!mit-eddie!ll-xn!cit-vax!usc-oberon!castor.usc.edu!blarson From: blarson@castor.usc.edu (Bob Larson) Newsgroups: comp.lang.c Subject: Constant expression to round down to power of 2 desired Message-ID: <1265@castor.usc.edu> Date: Sun, 22-Mar-87 20:25:07 EST Article-I.D.: castor.1265 Posted: Sun Mar 22 20:25:07 1987 Date-Received: Tue, 24-Mar-87 01:45:27 EST Reply-To: blarson@castor.usc.edu Distribution: world Organization: USC AIS, Los Angeles Lines: 13 Does anyone have an expression that can be computed at compile time to round a constant down to a power of 2? (Conversions from round-up and the boundary case are trivial.) I'm currently using a run-time iterative solution, but I'll probably convert it to nested ?: operations before the code is released. Please reply directly to me, I'll summarize if there is interest. -- Bob Larson Arpa: Blarson@Usc-Eclb.Arpa Uucp: (several backbone sites)!sdcrdcf!usc-oberon!castor.usc.edu!blarson seismo!cit-vax!usc-oberon!castor.usc.edu!blarson