Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #107281
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: How to create a 128 bit type in C |
| Date | 2017-03-28 18:15 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87poh1wcex.fsf@bsb.me.uk> (permalink) |
| References | <d784ced7-2a27-4ae9-865b-191f460661aa@googlegroups.com> |
acidlategamer@gmail.com writes:
> Today a friend of mine asked this to me create a 128 bit type and you
> are given two 64 bit int type. One is sint64_t and one is uint64_t
>
> I said I can create it like this,
>
> struct int128_t{
> sint64_t sint;
> uint64_t uint;
> }a, b;
> now he said to compare two such types in this function
> a == b, return 0
> a > b, return 1
> a < b return -1
<snip>
> Anyone can think of any way?
One option: treat the numbers as two unsigned 64-bit ints and compare as
normal, but, on return, if the top bits of the two high words differ,
invert the result.
--
Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to create a 128 bit type in C acidlategamer@gmail.com - 2017-03-28 08:26 -0700
Re: How to create a 128 bit type in C BartC <bc@freeuk.com> - 2017-03-28 16:42 +0100
Re: How to create a 128 bit type in C acidlategamer@gmail.com - 2017-03-28 09:15 -0700
Re: How to create a 128 bit type in C BartC <bc@freeuk.com> - 2017-03-28 19:15 +0100
Re: How to create a 128 bit type in C Norbert_Paul <norbertpauls_spambin@yahoo.com> - 2017-03-28 17:44 +0200
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-28 16:29 +0000
Re: How to create a 128 bit type in C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-03-28 10:52 -0700
Re: How to create a 128 bit type in C Ike Naar <ike@iceland.freeshell.org> - 2017-03-28 17:55 +0000
Re: How to create a 128 bit type in C jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-28 20:17 +0200
Re: How to create a 128 bit type in C David Brown <david.brown@hesbynett.no> - 2017-03-28 21:17 +0200
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-28 18:09 +0000
Re: How to create a 128 bit type in C jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-28 19:52 +0200
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-28 18:11 +0000
Re: How to create a 128 bit type in C BartC <bc@freeuk.com> - 2017-03-28 19:21 +0100
Re: How to create a 128 bit type in C jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-28 20:29 +0200
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-28 18:55 +0000
Re: How to create a 128 bit type in C jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-28 21:04 +0200
Re: How to create a 128 bit type in C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-03-28 12:13 -0700
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-03-28 16:14 -0500
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-29 13:13 +0000
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-03-30 00:12 -0500
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-30 13:36 +0000
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-03-30 12:41 -0500
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-30 17:55 +0000
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-30 17:59 +0000
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-04-01 00:42 -0500
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-04-03 13:37 +0000
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-04-03 17:38 -0500
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-04-03 17:49 -0500
Re: How to create a 128 bit type in C Keith Thompson <kst-u@mib.org> - 2017-04-03 17:43 -0700
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-04-03 20:39 -0500
Re: How to create a 128 bit type in C Richard Heathfield <rjh@cpax.org.uk> - 2017-04-04 07:00 +0100
Re: How to create a 128 bit type in C jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-28 20:28 +0200
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-03-28 16:37 -0500
Re: How to create a 128 bit type in C jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-28 23:56 +0200
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-03-28 18:36 -0500
Re: How to create a 128 bit type in C jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-29 01:43 +0200
Re: English grammar, nonrestrictive clause Noob <root@127.0.0.1> - 2017-03-31 21:24 +0200
Re: English grammar, nonrestrictive clause jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-31 21:51 +0200
Re: English grammar, nonrestrictive clause Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-01 12:34 +0100
Re: How to create a 128 bit type in C supercat@casperkitty.com - 2017-03-28 15:11 -0700
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-03-28 19:30 -0500
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-29 13:19 +0000
Re: How to create a 128 bit type in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-29 14:42 +0100
Re: How to create a 128 bit type in C scott@slp53.sl.home (Scott Lurndal) - 2017-03-29 15:12 +0000
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-03-30 00:26 -0500
Re: How to create a 128 bit type in C Robert Wessel <robertwessel2@yahoo.com> - 2017-03-30 00:42 -0500
Re: How to create a 128 bit type in C Keith Thompson <kst-u@mib.org> - 2017-03-28 11:40 -0700
Re: How to create a 128 bit type in C Keith Thompson <kst-u@mib.org> - 2017-03-28 11:40 -0700
Re: How to create a 128 bit type in C jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-28 20:48 +0200
Re: How to create a 128 bit type in C Keith Thompson <kst-u@mib.org> - 2017-03-28 12:05 -0700
Re: How to create a 128 bit type in C Richard Heathfield <rjh@cpax.org.uk> - 2017-03-28 20:13 +0100
Re: How to create a 128 bit type in C jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-28 21:43 +0200
Re: Thunderbird charset Noob <root@127.0.0.1> - 2017-03-31 21:38 +0200
Re: How to create a 128 bit type in C David Brown <david.brown@hesbynett.no> - 2017-03-28 21:19 +0200
Re: How to create a 128 bit type in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-28 18:15 +0100
Re: How to create a 128 bit type in C Barry Schwarz <schwarzb@dqel.com> - 2017-03-28 10:27 -0700
Re: How to create a 128 bit type in C "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-03-28 14:16 -0700
Re: How to create a 128 bit type in C "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-03-28 17:38 -0700
Re: How to create a 128 bit type in C Thiago Adams <thiago.adams@gmail.com> - 2017-03-30 05:19 -0700
Re: How to create a 128 bit type in C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-03-30 05:32 -0700
Re: How to create a 128 bit type in C Thiago Adams <thiago.adams@gmail.com> - 2017-03-30 05:40 -0700
csiph-web