Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site harvard.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!harvard!stew From: stew@harvard.ARPA (Stew Rubenstein) Newsgroups: net.lang.c Subject: Re: How does one construct a mask for the MS bit? Message-ID: <455@harvard.ARPA> Date: Sun, 10-Mar-85 07:35:10 EST Article-I.D.: harvard.455 Posted: Sun Mar 10 07:35:10 1985 Date-Received: Tue, 12-Mar-85 20:30:50 EST References: <8849@brl-tgr.ARPA> <169@dmsd.UUCP> Organization: Aiken Computation Laboratory, Harvard Lines: 19 > seems that this should work: > > #define MSB(a) (1<<((sizeof a) * 8 - 1)) > > for most unix machines. > -- > John Bass > DMS Design (System Performance and Arch Consultants) > {dual,fortune,idi,hpda}!dmsd!bass (408) 996-0557 Is it portable to assume 8 bit bytes? Answer: no, but since there is no bitsizeof operator, sometimes we must. There are unix machines which do not use 8 bit bytes (the BBN C-30 and C-70 come to mind, maybe also some honeywell machines). There is also the PDP-10 which, to the best of my knowledge, does not run unix, but does have C. -- ----------------------- Stew Rubenstein UUCP: ihnp4!harvard!stew Harvard Chemistry ARPA: stew@harvard