Bad LALIGN(p) define for pdp11 in sysmacros.h
Badger BA 64810
bbadger at x102c.harris-atd.com
Fri Sep 29 06:38:52 AEST 1989
In article <11150 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <2721 at trantor.harris-atd.com> bbadger at 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 at trantor.harris-atd.com|'s/./&&/g' Tom sed expansively.
More information about the Comp.bugs.sys5
mailing list