Article View: comp.bugs.sys5
Article #110Re: Bad LALIGN(p) define for pdp11 in sysmacros.h
From: Badger BA 64810
Date: Thu, 28 Sep 1989 20:38
Date: Thu, 28 Sep 1989 20:38
62 lines
2928 bytes
2928 bytes
In article <11150@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes:
>In article <2721@trantor.harris-atd.com> bbadger@x102c.harris-atd.com (Badger BA 64810) writes:
>>Now the LALIGN(p) matches the one defined for when
>>``#if vax | i386'' is in effect (not shown here).
>
>Yeah, and now you've broken it. PDP-11 longs need be aligned
>only on a word boundary, not on a longword boundary.
>
Well, I thought that longs might only be aligned to even bytes,
but then shouldn't the definition of LALIGN be the same as IALIGN?
#ifdef pdp11
#define SALIGN(p) (char *)(((int)p+1) & ~1)
#define IALIGN(p) (char *)(((int)p+1) & ~1)
#define LALIGN(p) (char *)(((int)p+1) & ~3) /* ??? */
#endif
#if vax | i386
#define SALIGN(p) (char *)(((int)p+1) & ~1)
#define IALIGN(p) (char *)(((int)p+3) & ~3)
#define LALIGN(p) (char *)(((int)p+3) & ~3)
#endif
An generalized alignment macro would always use the same number like this:
#define ALIGN(p,m) (char *)(((int)p+m) & ~m)
p +1&~3 +3&~3
0 0 0
1 0 4
2 0 4
3 4 4
4 4 4
5 4 8
6 4 8
7 8 8
8 8 8
Is there any possible reason to use the +1&~3 pattern? I can't see it.
>>1. Technical: Is it really a good idea to convert to (int)?
>
>On a PDP-11, sure.
I was more worried about the VAX.
#define LALIGN(p) (char *)(((int)p+3) & ~3)
However, I guess since each macro set is machine dependent, it could
be changed to handle whatever int size that pointers turned out to be.
I guess that there isn't a machine-independent way to do this. It
should only be a problem if (sizeof(int) != sizeof(* char)).
>
>>2. Procedural: What's the official way to submit these things to ATT?
>
>Submit a software trouble report. If you have subscribed to
>the appropriate level of software support, you should have a
>folder that contains forms and instructions.
>
>>Is there an ATT network address which accepts bug reports, like Sun has?
>
>There is (or was) a command "trenter" that would guide you through
>the steps of filling out a trouble report then e-mail it somewhere.
No such command here.
----- - - - - - - - ----
Bernard A. Badger Jr. 407/984-6385 |``Get a LIFE!'' -- J.H. Conway
Harris GISD, Melbourne, FL 32902 |Buddy, can you paradigm?
Internet: bbadger%x102c@trantor.harris-atd.com|'s/./&&/g' Tom sed expansively.
Technical Details
Message-ID:
<2734@trantor.harris-atd.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!ucsd!nosc!logicon.arpa!trantor.harris-atd.com!x102c!bbadgerReferences:
<2721@trantor.harris-atd.com> <11150@smoke.BRL.MIL>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!ucsd!nosc!logicon.arpa!trantor.harris-atd.com!x102c!bbadger From: bbadger@x102c.harris-atd.com (Badger BA 64810) Newsgroups: comp.bugs.sys5 Subject: Re: Bad LALIGN(p) define for pdp11 in sysmacros.h Message-ID: <2734@trantor.harris-atd.com> Date: 28 Sep 89 20:38:52 GMT References: <2721@trantor.harris-atd.com> <11150@smoke.BRL.MIL> Sender: news@trantor.harris-atd.com Reply-To: bbadger@x102c.harris-atd.com (Badger BA 64810) Organization: Harris GISD, Melbourne, FL Lines: 62