Computer Chess Club Archives


Search

Terms

Messages

Subject: __assume keyword

Author: Gerd Isenberg

Date: 07:35:34 07/09/03

Go up one level in this thread


Thanks to Andrei Fortuna's CCC-Search Engine and Eugene Nalimov, i found the
MS-keyword to suppress the switch range check before indirect jumps in MSVC.

http://fortuna.iasi.rdsnet.ro/ccc/ccc.php?art_id=280581

Gerd


from MSDN-Libary:

__assume(expression)

The __assume keyword passes a hint to the optimizer. The optimizer assumes that
the condition represented by expression is true at the point where the keyword
appears and remains true until expression is altered (for example, by assignment
to a variable). Selective use of hints passed to the optimizer by __assume can
improve optimization.

The most common use of __assume is with the default case of a switch statement,
as shown below.

      default:
         __assume(0);
            // This tells the optimizer that the default
            // cannot be reached. As so it does not have to generate
            // the extra code to check that 'p' has a value
            // not represented by a case arm.  This makes the switch
            // run faster.




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.