Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 00036 00037 static const char source_file[] = __FILE__; 00038 00039 00040 /* ==================================================================== 00041 * 00042 * X_PROP_Create 00043 * 00044 * See interface description 00045 * 00046 * ==================================================================== 00047 */ 00048 00049 _X_PROP_TYPE_ * 00050 _X_PROP_CREATE_( 00051 INT32 universe_size, 00052 MEM_POOL *pool 00053 ) 00054 { 00055 /* We allocate fixed size bit vector, preceeded by its size. 00056 * Round up size to words and add 1 for the size. 00057 */ 00058 UINT32 words = ( (universe_size + _X_PROP_TYPE_SIZE_ - 1) 00059 >> _X_PROP_TYPE_SIZE_LOG2_) + 1; 00060 _X_PROP_TYPE_ *prop = TYPE_MEM_POOL_ALLOC_N(_X_PROP_TYPE_, pool, words); 00061 if ( ! MEM_POOL_Zeroed(pool) ) bzero(prop, words * sizeof(_X_PROP_TYPE_)); 00062 prop[0] = universe_size; 00063 return prop; 00064 } 00065 00066 00067 /* ==================================================================== 00068 * 00069 * X_PROP_Set 00070 * 00071 * See interface description 00072 * 00073 * ==================================================================== 00074 */ 00075 00076 void 00077 _X_PROP_SET_( 00078 _X_PROP_TYPE_ *prop, 00079 _X_PROP_LOCAL_BASE_TYPE_ x 00080 ) 00081 { 00082 UINT32 id = _X_id_(x); 00083 00084 Is_True(id < prop[0], ("property id out of range")); 00085 00086 (prop+1)[id >> _X_PROP_TYPE_SIZE_LOG2_] |= 00087 (_X_PROP_TYPE_)1 << (id & (_X_PROP_TYPE_SIZE_-1)); 00088 } 00089 00090 00091 /* ==================================================================== 00092 * 00093 * X_PROP_Reset 00094 * 00095 * See interface description 00096 * 00097 * ==================================================================== 00098 */ 00099 00100 void 00101 _X_PROP_RESET_( 00102 _X_PROP_TYPE_ *prop, 00103 _X_PROP_LOCAL_BASE_TYPE_ x 00104 ) 00105 { 00106 UINT32 id = _X_id_(x); 00107 00108 Is_True(id < prop[0], ("property id out of range")); 00109 00110 (prop+1)[id >> _X_PROP_TYPE_SIZE_LOG2_] &= 00111 ~((_X_PROP_TYPE_)1 << (id & (_X_PROP_TYPE_SIZE_-1))); 00112 } 00113 00114 00115 /* ==================================================================== 00116 * 00117 * X_PROP_Get 00118 * 00119 * See interface description 00120 * 00121 * ==================================================================== 00122 */ 00123 00124 BOOL 00125 _X_PROP_GET_( 00126 _X_PROP_TYPE_ *prop, 00127 _X_PROP_LOCAL_BASE_TYPE_ x 00128 ) 00129 { 00130 UINT32 id = _X_id_(x); 00131 00132 Is_True(id < prop[0], ("property id out of range")); 00133 00134 return ((prop+1)[id >> _X_PROP_TYPE_SIZE_LOG2_] 00135 & ((_X_PROP_TYPE_)1 << (id & (_X_PROP_TYPE_SIZE_-1)))) != 0; 00136 } 00137 00138 00139 /* ==================================================================== 00140 * 00141 * X_PROP_Uniond 00142 * 00143 * See interface description 00144 * 00145 * ==================================================================== 00146 */ 00147 00148 void 00149 _X_PROP_UNIOND_( 00150 _X_PROP_TYPE_ *prop0, 00151 _X_PROP_TYPE_ *prop1 00152 ) 00153 { 00154 UINT32 i; 00155 UINT32 universe_size = prop0[0]; 00156 UINT32 words = (universe_size + _X_PROP_TYPE_SIZE_-1) 00157 >> _X_PROP_TYPE_SIZE_LOG2_; 00158 00159 Is_True(universe_size == prop1[0], ("vectors are different length")); 00160 00161 for ( i = 1; i <= words; ++i ) prop0[i] |= prop1[i]; 00162 } 00163 00164 00165 /* ==================================================================== 00166 * 00167 * X_PROP_Intersection_Is_NonEmpty 00168 * 00169 * See interface description 00170 * 00171 * ==================================================================== 00172 */ 00173 00174 BOOL 00175 _X_PROP_INTERSECTION_IS_NONEMPTY_( 00176 _X_PROP_TYPE_ *prop0, 00177 _X_PROP_TYPE_ *prop1 00178 ) 00179 { 00180 UINT32 i; 00181 UINT32 universe_size = prop0[0]; 00182 UINT32 words = (universe_size + _X_PROP_TYPE_SIZE_-1) 00183 >> _X_PROP_TYPE_SIZE_LOG2_; 00184 00185 Is_True(universe_size == prop1[0], ("vectors are different length")); 00186 00187 for ( i = 1; i <= words; ++i ) { 00188 if ( (prop0[i] & prop1[i]) != 0 ) return TRUE; 00189 } 00190 return FALSE; 00191 }