Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Size of int on Alpha
@ 1998-03-04  5:00 Sivaram Krishnan
  1998-03-04  5:00 ` Paul Black
  1998-03-05  5:00 ` Volker Barthelmann
  0 siblings, 2 replies; 4+ messages in thread
From: Sivaram Krishnan @ 1998-03-04  5:00 UTC (permalink / raw)





1) What is the size of int (sizeof(int)) on an Alpha system running
    Windows NT?

If it is 32-bits or 4-bytes, what is the result of the following
operation?

    int i = 0x80000000;  /* left most bit alone set */
    int j;

    j = i << 1;                /* left shift i by 1 */

What is the value of j?

Since Alpha is a 64-bit architecture and since it does not
support 32-bit shifts (Alpha has only 64-bit shift instructions),
does the compiler mask the upper 4 bytes using extra instructions?
This would seem expensive.  If the size of int is always
8 bytes, this problem does not arise.

2) Is the size of int different on Unix systems on Alpha?

Thanks for your help.

Sivaram





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Size of int on Alpha
  1998-03-04  5:00 Size of int on Alpha Sivaram Krishnan
@ 1998-03-04  5:00 ` Paul Black
  1998-03-05  5:00   ` Steve Lionel
  1998-03-05  5:00 ` Volker Barthelmann
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Black @ 1998-03-04  5:00 UTC (permalink / raw)



Sivaram Krishnan <sivaram@atlantis-consulting.com> wrote:
> 1) What is the size of int (sizeof(int)) on an Alpha system running
>     Windows NT?

Don't know. I don't program on Windows (of any kind).


> If it is 32-bits or 4-bytes, what is the result of the following
> operation?
> 
>     int i = 0x80000000;  /* left most bit alone set */
>     int j;
> 
>     j = i << 1;                /* left shift i by 1 */
> 
> What is the value of j?

For a 32-bit int, 0, what other value would you expect?


> Since Alpha is a 64-bit architecture and since it does not
> support 32-bit shifts (Alpha has only 64-bit shift instructions),
> does the compiler mask the upper 4 bytes using extra instructions?
> This would seem expensive.  If the size of int is always
> 8 bytes, this problem does not arise.

If the compiler uses 32-bit ints, then it will have to deal with this.


> 2) Is the size of int different on Unix systems on Alpha?

32 bit on DU3.2 (presumably the same on later versions).

Paul



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Size of int on Alpha
  1998-03-04  5:00 ` Paul Black
@ 1998-03-05  5:00   ` Steve Lionel
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Lionel @ 1998-03-05  5:00 UTC (permalink / raw)




Sivaram Krishnan <sivaram@atlantis-consulting.com> wrote:
|>> 1) What is the size of int (sizeof(int)) on an Alpha system running
|>>     Windows NT?

On Windows NT on both Intel and Alpha, int is 32 bits and so is long.
-- 
Steve Lionel                      mailto:Steve.Lionel@digital.com
Fortran Development               http://www.digital.com/info/slionel.html
Digital Equipment Corporation     
110 Spit Brook Road, ZKO2-3/N30    
Nashua, NH 03062-2698             "Free advice is worth every cent"

For information on DIGITAL Fortran, see http://www.digital.com/fortran



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Size of int on Alpha
  1998-03-04  5:00 Size of int on Alpha Sivaram Krishnan
  1998-03-04  5:00 ` Paul Black
@ 1998-03-05  5:00 ` Volker Barthelmann
  1 sibling, 0 replies; 4+ messages in thread
From: Volker Barthelmann @ 1998-03-05  5:00 UTC (permalink / raw)



Sivaram Krishnan <sivaram@atlantis-consulting.com> wrote:


: 1) What is the size of int (sizeof(int)) on an Alpha system running
:     Windows NT?

Never tried on NT, but I'm pretty sure it's 4.

: If it is 32-bits or 4-bytes, what is the result of the following
: operation?

:     int i = 0x80000000;  /* left most bit alone set */
:     int j;

:     j = i << 1;                /* left shift i by 1 */

: What is the value of j?

Should be 0.

: Since Alpha is a 64-bit architecture and since it does not
: support 32-bit shifts (Alpha has only 64-bit shift instructions),
: does the compiler mask the upper 4 bytes using extra instructions?

Actually, in this case you can use a 32bit add to perform the shift.
In other cases the compiler has to insert extra instructions, yes.

: This would seem expensive.  If the size of int is always
: 8 bytes, this problem does not arise.

It's not terribly expensive. Compilers don't have to insert those
instructions always. They usually try to keep track of what's in the
upper 32bits of a register and only insert them when necessary.

With sizeof(int)==8 the memory usage would be higher. Pretty hard to
say which would be better in what cases. Also I assume 64bit ints would
break lots of Windows-code.

: 2) Is the size of int different on Unix systems on Alpha?

They use sizeof(int)==4 and sizeof(long)==8. AFAIK NT uses sizeof(long)==4.

Volker






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-03-05  5:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-03-04  5:00 Size of int on Alpha Sivaram Krishnan
1998-03-04  5:00 ` Paul Black
1998-03-05  5:00   ` Steve Lionel
1998-03-05  5:00 ` Volker Barthelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox