From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,7e4b782a25f7c394 X-Google-Attributes: gid1164f8,public X-Google-Thread: 102b75,7e4b782a25f7c394 X-Google-Attributes: gid102b75,public From: Volker Barthelmann Subject: Re: Size of int on Alpha Date: 1998/03/05 Message-ID: <6dkpic$33l@vb.franken.de>#1/1 X-Deja-AN: 331036436 References: <34FD104F.B9FCF863@atlantis-consulting.com> Organization: home Newsgroups: comp.sys.dec,comp.arch Sivaram Krishnan 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