Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / October 2003

Tip: Looking for answers? Try searching our database.

Is this an appropriate place to ask about CIL?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon Shemitz - 04 Oct 2003 04:42 GMT
Partition III, section 1.1.2 says "A CLI Boolean type occupies one
byte in memory. A bit pattern of all zeroes denotes a value of false.
A bit pattern with any one or more bits set (analogous to a non-zero
integer) denotes a value of true."

Where does CIL actually use this datatype? The Cxx instructions put an
int32 on the stack; the brtrue and brfalse instructions take 32-bit
values, not a 1-byte boolean.

Signature

programmer, author  http://www.midnightbeach.com
and father          http://www.midnightbeach.com/hs

Ori Gershony [MSFT] - 06 Oct 2003 23:27 GMT
The evaluation stack uses the natural word size of the machine, but the
types themselves can have a different in-memory representations, and as a
result will get expanded when they will be loaded into the evaluation stack
(via ldloc, ldfld, etc.).  In the case of the Boolean type, this can save
you 3 bytes on 32bit machines (assuming you have other small types to pack
the structure with).

-- Ori.

--------------------
>Message-ID: <3F7E41BC.6F333EC5@midnightbeach.com>
>Date: Fri, 03 Oct 2003 20:42:52 -0700
[quoted text clipped - 22 lines]
>int32 on the stack; the brtrue and brfalse instructions take 32-bit
>values, not a 1-byte boolean.

Signature

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note:  For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.

Jon Shemitz - 07 Oct 2003 05:04 GMT

> The evaluation stack uses the natural word size of the machine, but the
> types themselves can have a different in-memory representations, and as a
> result will get expanded when they will be loaded into the evaluation stack
> (via ldloc, ldfld, etc.).  In the case of the Boolean type, this can save
> you 3 bytes on 32bit machines (assuming you have other small types to pack
> the structure with).

Thx. I'd already found that C# could ld a bool and brtrue or brfalse
it, and seen a line or two in the docs that sort of allude to this -
this is a deeper explanation than I've seen.

Signature

programmer, author  http://www.midnightbeach.com
and father          http://www.midnightbeach.com/hs


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.