Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #155484 > unrolled thread
| Started by | dfs <nospam@dfs.com> |
|---|---|
| First post | 2020-10-09 20:11 -0400 |
| Last post | 2020-10-10 14:01 -0700 |
| Articles | 11 on this page of 131 — 23 participants |
Back to article view | Back to comp.lang.c
Trick to knowing hex address alignment? dfs <nospam@dfs.com> - 2020-10-09 20:11 -0400
Re: Trick to knowing hex address alignment? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-10-09 18:43 -0600
Re: Trick to knowing hex address alignment? dfs <nospam@dfs.com> - 2020-10-09 22:14 -0400
Re: Trick to knowing hex address alignment? Kaz Kylheku <793-849-0957@kylheku.com> - 2020-10-10 01:10 +0000
Re: Trick to knowing hex address alignment? dfs <nospam@dfs.com> - 2020-10-09 22:15 -0400
Re: Trick to knowing hex address alignment? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2020-10-10 01:30 -0400
Re: Trick to knowing hex address alignment? BGB <cr88192@gmail.com> - 2020-10-10 01:30 -0500
Re: Trick to knowing hex address alignment? "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2020-10-12 16:58 -0400
Re: Trick to knowing hex address alignment? BGB <cr88192@gmail.com> - 2020-10-14 16:04 -0500
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-10 18:31 +0200
Re: Trick to knowing hex address alignment? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-10-10 09:46 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-10 19:50 +0200
Re: Trick to knowing hex address alignment? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-10-10 18:45 +0000
Re: Trick to knowing hex address alignment? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-10-10 15:05 -0400
Re: Trick to knowing hex address alignment? "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2020-10-10 12:34 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-11 08:10 +0200
Re: Trick to knowing hex address alignment? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-10-11 02:29 -0700
Re: Trick to knowing hex address alignment? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-10-11 12:08 +0100
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-11 13:13 +0200
Re: Trick to knowing hex address alignment? Richard Damon <Richard@Damon-Family.org> - 2020-10-11 15:06 -0400
Re: Trick to knowing hex address alignment? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-10-11 15:27 -0400
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 07:18 +0200
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 08:19 +0200
Re: Trick to knowing hex address alignment? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-10-12 00:43 -0700
Re: Trick to knowing hex address alignment? David Brown <david.brown@hesbynett.no> - 2020-10-12 12:03 +0200
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 13:14 +0200
Re: Trick to knowing hex address alignment? Richard Damon <Richard@Damon-Family.org> - 2020-10-12 08:33 -0400
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 16:21 +0200
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-12 14:07 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 06:58 +0200
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-13 00:10 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 09:53 +0200
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-13 01:25 -0700
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-13 01:31 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 10:34 +0200
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-13 01:47 -0700
Re: Trick to knowing hex address alignment? Kaz Kylheku <793-849-0957@kylheku.com> - 2020-10-13 15:39 +0000
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-13 16:16 -0700
Re: Trick to knowing hex address alignment? scott@slp53.sl.home (Scott Lurndal) - 2020-10-12 14:32 +0000
Re: Trick to knowing hex address alignment? "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2020-10-12 07:13 -0700
Re: Trick to knowing hex address alignment? David Brown <david.brown@hesbynett.no> - 2020-10-12 19:16 +0200
Re: Trick to knowing hex address alignment? Vir Campestris <vir.campestris@invalid.invalid> - 2020-10-12 21:26 +0100
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-12 14:08 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 06:50 +0200
Re: Trick to knowing hex address alignment? Vir Campestris <vir.campestris@invalid.invalid> - 2020-10-11 21:16 +0100
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 07:18 +0200
Re: Trick to knowing hex address alignment? arnold@hooterville.invalid (Arnold Ziffel) - 2020-10-13 11:44 +0000
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 14:21 +0200
Re: Trick to knowing hex address alignment? arnold@hooterville.invalid (Arnold Ziffel) - 2020-10-13 13:18 +0000
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 18:19 +0200
Re: Trick to knowing hex address alignment? "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2020-10-11 14:12 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 07:20 +0200
Re: Trick to knowing hex address alignment? "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2020-10-12 07:09 -0700
Re: Trick to knowing hex address alignment? scott@slp53.sl.home (Scott Lurndal) - 2020-10-12 14:35 +0000
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 16:37 +0200
Re: Trick to knowing hex address alignment? Bart <bc@freeuk.com> - 2020-10-12 15:51 +0100
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 17:07 +0200
Re: Trick to knowing hex address alignment? Bart <bc@freeuk.com> - 2020-10-12 16:45 +0100
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 17:47 +0200
Re: Trick to knowing hex address alignment? Bart <bc@freeuk.com> - 2020-10-12 17:05 +0100
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 06:46 +0200
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-12 14:19 -0700
Re: Trick to knowing hex address alignment? arnold@hooterville.invalid (Arnold Ziffel) - 2020-10-13 11:48 +0000
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 14:22 +0200
Re: Trick to knowing hex address alignment? "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> - 2020-10-13 06:25 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 18:20 +0200
Re: Trick to knowing hex address alignment?, speciall Richard Damon <Richard@Damon-Family.org> - 2020-10-13 12:38 -0400
Re: Trick to knowing hex address alignment?, speciall James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-10-13 12:51 -0400
Re: Trick to knowing hex address alignment? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-10-12 11:11 -0600
Re: Trick to knowing hex address alignment? scott@slp53.sl.home (Scott Lurndal) - 2020-10-12 18:50 +0000
Re: Trick to knowing hex address alignment? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-10-12 13:03 -0600
Re: Trick to knowing hex address alignment? scott@slp53.sl.home (Scott Lurndal) - 2020-10-12 19:30 +0000
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 06:47 +0200
Re: Trick to knowing hex address alignment? arnold@hooterville.invalid (Arnold Ziffel) - 2020-10-13 11:52 +0000
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 14:23 +0200
Re: Trick to knowing hex address alignment? Bart <bc@freeuk.com> - 2020-10-13 14:43 +0100
Re: Trick to knowing hex address alignment? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-10-13 08:57 -0600
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 18:21 +0200
Re: Trick to knowing hex address alignment? Bart <bc@freeuk.com> - 2020-10-13 17:38 +0100
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 19:03 +0200
Re: Trick to knowing hex address alignment? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-10-13 11:20 -0600
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 19:23 +0200
Re: Trick to knowing hex address alignment? Bart <bc@freeuk.com> - 2020-10-13 18:28 +0100
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 19:30 +0200
Re: Trick to knowing hex address alignment? arnold@hooterville.invalid (Arnold Ziffel) - 2020-10-14 09:24 +0000
Re: Trick to knowing hex address alignment? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-10-14 09:35 -0400
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-15 09:29 +0200
Re: Trick to knowing hex address alignment? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-10-13 10:24 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 19:31 +0200
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-13 14:47 -0700
Re: Trick to knowing hex address alignment? Richard Damon <Richard@Damon-Family.org> - 2020-10-12 21:48 -0400
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 06:49 +0200
Re: Trick to knowing hex address alignment? scott@slp53.sl.home (Scott Lurndal) - 2020-10-13 15:24 +0000
Re: Trick to knowing hex address alignment? Richard Damon <Richard@Damon-Family.org> - 2020-10-13 12:32 -0400
Re: Trick to knowing hex address alignment? Vir Campestris <vir.campestris@invalid.invalid> - 2020-10-13 21:55 +0100
Re: Trick to knowing hex address alignment? Vir Campestris <vir.campestris@invalid.invalid> - 2020-10-13 22:00 +0100
Re: Trick to knowing hex address alignment? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-10-13 14:13 -0700
Re: Trick to knowing hex address alignment? David Brown <david.brown@hesbynett.no> - 2020-10-14 13:13 +0200
Re: Trick to knowing hex address alignment? scott@slp53.sl.home (Scott Lurndal) - 2020-10-14 15:59 +0000
Re: Trick to knowing hex address alignment? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-10-14 11:31 -0600
Re: Trick to knowing hex address alignment? scott@slp53.sl.home (Scott Lurndal) - 2020-10-14 19:03 +0000
Re: Trick to knowing hex address alignment? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-10-13 09:50 -0600
Re: Trick to knowing hex address alignment? Kaz Kylheku <793-849-0957@kylheku.com> - 2020-10-13 17:41 +0000
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 20:07 +0200
Re: Trick to knowing hex address alignment? Kaz Kylheku <793-849-0957@kylheku.com> - 2020-10-15 00:38 +0000
Re: Trick to knowing hex address alignment? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-10-14 21:23 -0600
Re: Trick to knowing hex address alignment? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-10-12 11:20 +0100
Re: Trick to knowing hex address alignment? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-10-12 10:19 -0400
Re: Trick to knowing hex address alignment? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-10-10 15:42 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-11 13:14 +0200
Re: Trick to knowing hex address alignment? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-10-11 14:11 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 07:20 +0200
Re: Trick to knowing hex address alignment? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-10-12 00:42 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 13:16 +0200
Re: Trick to knowing hex address alignment? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-10-12 07:22 -0700
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 16:23 +0200
Re: Trick to knowing hex address alignment? scott@slp53.sl.home (Scott Lurndal) - 2020-10-12 14:35 +0000
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-12 16:40 +0200
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-12 14:09 -0700
Re: Trick to knowing hex address alignment? David Brown <david.brown@hesbynett.no> - 2020-10-12 08:26 +0200
Re: Trick to knowing hex address alignment? Öö Tiib <ootiib@hot.ee> - 2020-10-12 03:19 -0700
Re: Trick to knowing hex address alignment? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-10-12 07:22 -0700
Re: Trick to knowing hex address alignment? arnold@hooterville.invalid (Arnold Ziffel) - 2020-10-13 11:59 +0000
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 14:25 +0200
Re: Trick to knowing hex address alignment? scott@slp53.sl.home (Scott Lurndal) - 2020-10-13 15:26 +0000
Re: Trick to knowing hex address alignment? DFS <nospam@dfs.com> - 2020-10-13 11:33 -0400
Re: Trick to knowing hex address alignment? Christian Hanné <the.hanne@gmail.com> - 2020-10-13 18:23 +0200
Re: Trick to knowing hex address alignment? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-10-11 09:47 -0600
Re: Trick to knowing hex address alignment? Elias Schwerdtfeger <nachtwaechter@tamagothi.de> - 2020-10-10 18:45 +0200
Re: Trick to knowing hex address alignment? Barry Schwarz <schwarzb@delq.com> - 2020-10-10 10:32 -0700
Re: Trick to knowing hex address alignment? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-10-10 14:01 -0700
Page 7 of 7 — ← Prev page 1 2 3 4 5 6 [7]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2020-10-12 03:19 -0700 |
| Message-ID | <9a42eb24-0e4d-485d-bd10-4022272590beo@googlegroups.com> |
| In reply to | #155556 |
On Monday, 12 October 2020 09:26:56 UTC+3, David Brown wrote: > On 11/10/2020 23:11, Keith Thompson wrote: > > Christian Hanné <the.hanne@gmail.com> writes: > >>> Convert to unintptr_t and check the low-order bits. > >> > >> The conversion is ultimately slow. > > > > I wrote the text you quoted. Please leave attributions in place. > > > > I'm not sure just what you mean by "The conversion is ultimately > > slow", but it's almost certainly incorrect. Conversion between > > same-sized integer and pointer types is likely to be free, or > > nearly so. Note that my suggestion was a reply to your claim that > > calling sprintf() and checking the last character is "the most > > efficient solution". > > > > Are you serious? > > > > I think it is clear that Christian Hanné is serious about trolling > people. No one can possibly be as completely wrong and muddled as his > posts have suggested (and we've seen a few wrong and muddled people in > c.l.c. over the years). He is trolling. The only reason to reply to > his posts would be if you think he might be confusing other people. It seems to be same poster who deliberately wrote similar falsehoods under "Scott Newman" until September or so. Perhaps people stopped to respond and so it turned into "Christian Hanné" in September.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2020-10-12 07:22 -0700 |
| Message-ID | <87k0vv5xth.fsf@nosuchdomain.example.com> |
| In reply to | #155560 |
Öö Tiib <ootiib@hot.ee> writes:
[...]
> It seems to be same poster who deliberately wrote similar falsehoods
> under "Scott Newman" until September or so. Perhaps people stopped to
> respond and so it turned into "Christian Hanné" in September.
Perhaps, but I suggest not wasting time speculating on whether they're
the same person or not. It doesn't matter.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | arnold@hooterville.invalid (Arnold Ziffel) |
|---|---|
| Date | 2020-10-13 11:59 +0000 |
| Message-ID | <c0503a7a-540d-4deb-bd44-fd9fbe68c405@hooterville.invalid> |
| In reply to | #155560 |
Öö Tiib <ootiib@hot.ee> wrote: > It seems to be same poster who deliberately wrote similar falsehoods > under "Scott Newman" until September or so. Perhaps people stopped to > respond and so it turned into "Christian Hanné" in September. Scott Newman and Bonita Montero. Headers don't lie. -- The person who snores the loudest will fall asleep first.
[toc] | [prev] | [next] | [standalone]
| From | Christian Hanné <the.hanne@gmail.com> |
|---|---|
| Date | 2020-10-13 14:25 +0200 |
| Message-ID | <rm46b3$t36$4@gioia.aioe.org> |
| In reply to | #155613 |
>> It seems to be same poster who deliberately wrote similar falsehoods >> under "Scott Newman" until September or so. Perhaps people stopped to >> respond and so it turned into "Christian Hanné" in September. > Scott Newman and Bonita Montero. Headers don't lie. Sorry, my headers are different. I use an open Usenet-server whereas this Boni-whatever uses a Usenet-server which needs registration.
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2020-10-13 15:26 +0000 |
| Message-ID | <zGjhH.127958$MQ.66465@fx14.iad> |
| In reply to | #155617 |
=?UTF-8?Q?Christian_Hann=c3=a9?= <the.hanne@gmail.com> writes: >>> It seems to be same poster who deliberately wrote similar falsehoods >>> under "Scott Newman" until September or so. Perhaps people stopped to >>> respond and so it turned into "Christian Hanné" in September. > >> Scott Newman and Bonita Montero. Headers don't lie. > >Sorry, my headers are different. I use an open Usenet-server whereas >this Boni-whatever uses a Usenet-server which needs registration. > You must thing everyone else is as stupid as you are.
[toc] | [prev] | [next] | [standalone]
| From | DFS <nospam@dfs.com> |
|---|---|
| Date | 2020-10-13 11:33 -0400 |
| Message-ID | <JQjhH.380555$0W4.104101@fx42.iad> |
| In reply to | #155617 |
On 10/13/2020 8:25 AM, Christian Hanné wrote: >>> It seems to be same poster who deliberately wrote similar falsehoods >>> under "Scott Newman" until September or so. Perhaps people stopped to >>> respond and so it turned into "Christian Hanné" in September. > >> Scott Newman and Bonita Montero. Headers don't lie. > > Sorry, my headers are different. I use an open Usenet-server whereas > this Boni-whatever uses a Usenet-server which needs registration. Say "I love the C language much more than C++".
[toc] | [prev] | [next] | [standalone]
| From | Christian Hanné <the.hanne@gmail.com> |
|---|---|
| Date | 2020-10-13 18:23 +0200 |
| Message-ID | <rm4k93$1tpe$4@gioia.aioe.org> |
| In reply to | #155624 |
> Say "I love the C language much more than C++". ???
[toc] | [prev] | [next] | [standalone]
| From | Joe Pfeiffer <pfeiffer@cs.nmsu.edu> |
|---|---|
| Date | 2020-10-11 09:47 -0600 |
| Message-ID | <1b1ri4hii2.fsf@pfeifferfamily.net> |
| In reply to | #155491 |
Christian Hanné <the.hanne@gmail.com> writes: >> Is there a trick to quickly figuring the alignment? > > Do a sprintf and identify the 16-bit-aligned adresses by checking if > the last digit is 0, the 32-bit-aligned addresses by checking if the > last digit is 0 and the second last digit is even. That's the most > efficient solution. Given that the original question included the addresses he was asking about, there's no need to discuss how to obtain the addresses.
[toc] | [prev] | [next] | [standalone]
| From | Elias Schwerdtfeger <nachtwaechter@tamagothi.de> |
|---|---|
| Date | 2020-10-10 18:45 +0200 |
| Message-ID | <rlsoft$qrg$1@dont-email.me> |
| In reply to | #155484 |
Am 10.10.20 um 02:11 schrieb dfs: > Is there a trick to quickly figuring the alignment? In C? Oh yes, of course: #define _ALIGNED_HELPER(ADDR, N) ((ADDR) & ((1UL << (N)) - 1) == 0) #define TWO_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 1) #define FOUR_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 2) #define EIGHT_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 3) #define SIXTEEN_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 4) /* etc... */ Beware of the side-effects in using macros.
[toc] | [prev] | [next] | [standalone]
| From | Barry Schwarz <schwarzb@delq.com> |
|---|---|
| Date | 2020-10-10 10:32 -0700 |
| Message-ID | <c0s3oftivjgfbu09v823mrj6rqedrle4et@4ax.com> |
| In reply to | #155492 |
On Sat, 10 Oct 2020 18:45:49 +0200, Elias Schwerdtfeger <nachtwaechter@tamagothi.de> wrote: >Am 10.10.20 um 02:11 schrieb dfs: > >> Is there a trick to quickly figuring the alignment? > >In C? Oh yes, of course: > >#define _ALIGNED_HELPER(ADDR, N) ((ADDR) & ((1UL << (N)) - 1) == 0) The operands of the & operator must be integers. If ADDR is a pointer, this is a constraint violation. >#define TWO_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 1) >#define FOUR_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 2) >#define EIGHT_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 3) >#define SIXTEEN_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 4) >/* etc... */ > >Beware of the side-effects in using macros. -- Remove del for email
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Date | 2020-10-10 14:01 -0700 |
| Message-ID | <rlt7et$fp4$2@gioia.aioe.org> |
| In reply to | #155492 |
On 10/10/2020 9:45 AM, Elias Schwerdtfeger wrote:
> Am 10.10.20 um 02:11 schrieb dfs:
>
>> Is there a trick to quickly figuring the alignment?
>
> In C? Oh yes, of course:
>
> #define _ALIGNED_HELPER(ADDR, N) ((ADDR) & ((1UL << (N)) - 1) == 0)
> #define TWO_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 1)
> #define FOUR_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 2)
> #define EIGHT_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 3)
> #define SIXTEEN_BIT_ALIGNED(ADDR) _ALIGNED_HELPER((ADDR), 4)
> /* etc... */
>
> Beware of the side-effects in using macros.
>
This might be of interest here:
https://pastebin.com/raw/f37a23918
____________________
#define RALLOC_ALIGN_UP(mp_ptr, mp_align) \
((void*)( \
(((ralloc_uintptr_type)(mp_ptr)) + ((mp_align) - 1)) \
& ~(((mp_align) - 1)) \
))
#define RALLOC_ALIGN_ASSERT(mp_ptr, mp_align) \
(((void*)(mp_ptr)) == RALLOC_ALIGN_UP(mp_ptr, mp_align))
____________________
?
[toc] | [prev] | [standalone]
Page 7 of 7 — ← Prev page 1 2 3 4 5 6 [7]
Back to top | Article view | comp.lang.c
csiph-web