[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OpenBSD does not define INT8_MIN etc.
From: |
Paul Jarc |
Subject: |
Re: OpenBSD does not define INT8_MIN etc. |
Date: |
Sat, 10 Jul 2004 11:57:41 -0400 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
Marius Vollmer <address@hidden> wrote:
> #define SCM_I_UTYPE_MAX(type) (~(type)0)
Maybe just personal preference, but I'd use ((type)-1). That's
guaranteed to work by the C standard.
> #define SCM_I_TYPE_MAX(type,utype) ((type)((~(utype)0)/2))
> #define SCM_I_TYPE_MIN(type,utype) (-((type)((~(utype)0)/2))-1)
Will integer promotions get in the way here for smaller types? I
think (utype)0 will be promoted to int before ~ is applied, etc.
paul