From: Marius Vollmer <mvo@zagadka.de>
Cc: guile-devel@gnu.org
Subject: Re: OpenBSD does not define INT8_MIN etc.
Date: Sat, 10 Jul 2004 15:26:41 +0200 [thread overview]
Message-ID: <873c40xab2.fsf@zagadka.ping.de> (raw)
In-Reply-To: <CFC422FF-D24D-11D8-B8F3-000D93673682@gmx.net> ( Andreas Vögele's message of "Sat, 10 Jul 2004 10:47:44 +0200")
Andreas Vögele <voegelas@gmx.net> writes:
> OpenBSD 3.5 doesn't define INT8_MIN, INT8_MAX, UINT8_MAX etc.
Damn. I knew we couldn't rely on these being available...
> I could write a patch for gen-scmconfig.c and/or configure.in that
> handles this problem but I'm wondering why INT8_MIN etc. are
> necessary at all. Are there any architectures where INT8_MIN,
> INT16_MIN etc. aren't -128, -32768 etc.?
Yep, I had the same thoughts. There's no problem with INT8_MIN etc,
but I was afraid that for the larger sizes, there would be no portable
way to write the constants. For example, with GCC, UINT64_MAX is
"18446744073709551615ULL" where the "ULL" suffix is essential. That's
why I wanted to use the platform definition of UINT64_MAX, and for
symmetry, I used the platform definitions for the rest as well.
However, we already need to define LLONG_MIN, etc ourselves, and
currently, we rely on integers being in twos-complement. So, we could
just as well forego the platform definitons of INT8_MIN etc and define
them ourselves, maybe like so:
#define SCM_I_UTYPE_MAX(type) (~(type)0)
#define SCM_I_TYPE_MAX(type,utype) ((type)((~(utype)0)/2))
#define SCM_I_TYPE_MIN(type,utype) (-((type)((~(utype)0)/2))-1)
#define SCM_T_UINT8_MAX SCM_I_UTYPE_MAX(scm_t_uint8)
#define SCM_T_INT8_MIN SCM_I_TYPE_MIN(scm_t_int8,scm_t_uint8)
#define SCM_T_INT8_MAX SCM_I_TYPE_MAX(scm_t_int8,scm_t_uint8)
...
That should work for all kind of types.
I'll make this change.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2004-07-10 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-10 8:47 OpenBSD does not define INT8_MIN etc Andreas Vögele
2004-07-10 12:32 ` Andreas Vögele
2004-07-10 13:26 ` Marius Vollmer [this message]
2004-07-10 14:43 ` Andreas Vögele
2004-07-11 9:56 ` Andreas Vögele
2004-07-10 15:57 ` Paul Jarc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873c40xab2.fsf@zagadka.ping.de \
--to=mvo@zagadka.de \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).