Changeset 8d5d47 in git


Ignore:
Timestamp:
Jul 16, 1997, 12:16:08 PM (27 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', '82fc009ea2b0098c1a4896c841bb70860976bdfc')
Children:
f623b4afe1dacd66dc23ddffa288de1bedb86ad4
Parents:
b90dfc16706e69b66358e66230ee1efe9a068474
Message:
	* canonicalform.cc (CanonicalForm::ilog2): new method


git-svn-id: file:///usr/local/Singular/svn/trunk@519 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/canonicalform.cc

    rb90dfc1 r8d5d47  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: canonicalform.cc,v 1.9 1997-07-14 12:45:07 schmidt Exp $ */
     2/* $Id: canonicalform.cc,v 1.10 1997-07-16 10:16:08 schmidt Exp $ */
    33
    44#include <config.h>
     
    12901290}
    12911291
     1292//{{{ int CanonicalForm::ilog2( ) const
     1293//{{{ docu
     1294//
     1295// ilog2() - integer logarithm to base 2.
     1296//
     1297// Returns the largest integer smaller than logarithm of CO to
     1298// base 2.  CO should be an integer.
     1299//
     1300//}}}
     1301int
     1302CanonicalForm::ilog2( ) const
     1303{
     1304    if ( is_imm( value ) ) {
     1305        ASSERT( is_imm( value ) == INTMARK, "not implemented" );
     1306        int a = imm2int( value );
     1307        ASSERT( a > 0, "log arg <= 0" );
     1308        int n = -1;
     1309        while ( a != 0 ) {
     1310            n++;
     1311            a /= 2;
     1312        }
     1313        return n;
     1314    }
     1315    else
     1316        return value->ilog2();
     1317}
     1318//}}}
    12921319
    12931320int
Note: See TracChangeset for help on using the changeset viewer.