Changeset 73 in dev for BasicCompiler_Common/Type.cpp


Ignore:
Timestamp:
Mar 16, 2007, 11:07:14 PM (17 years ago)
Author:
dai_9181
Message:

Parameterクラスを適用。32bit側は動くようになったので、64bitのほうを調整する。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Type.cpp

    r71 r73  
    108108    return false;
    109109}
     110
     111
     112bool Type::Equals( const Type &type ) const
     113{
     114    if( basicType == type.basicType ){
     115        if( NATURAL_TYPE( basicType ) == DEF_OBJECT
     116            || NATURAL_TYPE( basicType ) == DEF_STRUCT ){
     117
     118                if( index == type.index ){
     119                    return true;
     120                }
     121
     122        }
     123        else{
     124            return true;
     125        }
     126    }
     127    return false;
     128}
     129
     130bool Type::IsNull() const{
     131  if( basicType == DEF_NON ){
     132      return true;
     133  }
     134  return false;
     135}
     136bool Type::IsPointer() const
     137{
     138    if(PTR_LEVEL( basicType )|| basicType == DEF_PTR_VOID || basicType == DEF_PTR_PROC
     139        || ( basicType & FLAG_PTR ) ){
     140            return true;
     141    }
     142
     143    return false;
     144}
     145bool Type::IsSigned() const
     146{
     147    switch( basicType ){
     148        case DEF_SBYTE:
     149        case DEF_INTEGER:
     150        case DEF_LONG:
     151        case DEF_INT64:
     152        case DEF_SINGLE:
     153        case DEF_DOUBLE:
     154            return true;
     155        default:
     156            break;
     157    }
     158    return false;
     159}
     160bool Type::IsNaturalWhole() const
     161{
     162    switch( basicType ){
     163        case DEF_SBYTE:
     164        case DEF_BYTE:
     165        case DEF_INTEGER:
     166        case DEF_WORD:
     167        case DEF_LONG:
     168        case DEF_DWORD:
     169        case DEF_INT64:
     170        case DEF_QWORD:
     171            return true;
     172        default:
     173            break;
     174    }
     175    return false;
     176}
     177bool Type::IsWhole() const
     178{
     179    return (
     180        IsNaturalWhole()
     181        || IsPtrType( basicType )
     182        || basicType == DEF_BOOLEAN
     183        );
     184}
     185bool Type::IsReal() const
     186{
     187    switch( basicType ){
     188        case DEF_SINGLE:
     189        case DEF_DOUBLE:
     190            return true;
     191        default:
     192            break;
     193    }
     194    return false;
     195}
     196bool Type::Is64() const
     197{
     198    switch( basicType ){
     199        case DEF_QWORD:
     200        case DEF_INT64:
     201            return true;
     202        default:
     203            break;
     204    }
     205    return false;
     206}
     207bool Type::IsProcPtr() const
     208{
     209    if( basicType == DEF_PTR_PROC ){
     210        return true;
     211    }
     212    return false;
     213}
     214bool Type::IsStruct() const
     215{
     216    if( basicType == DEF_STRUCT ){
     217        return true;
     218    }
     219    return false;
     220}
Note: See TracChangeset for help on using the changeset viewer.