Changeset 8710ff0 in git for factory/gfops.cc
- Timestamp:
- Sep 29, 2012, 1:49:36 PM (12 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 63e72b40a6237e50811b0e8745201177d25cb979
- Parents:
- d30a39922dc390f97b6cd257b2e7c55d483f4159
- git-author:
- Martin Lee <martinlee84@web.de>2012-09-29 13:49:36+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2012-10-19 11:05:30+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/gfops.cc
rd30a399 r8710ff0 222 222 } 223 223 224 long gf_gf2ff ( long a ) 225 { 226 if ( gf_iszero( a ) ) 227 return 0; 228 else 229 { 230 // starting from z^0=1, step through the table 231 // counting the steps until we hit z^a or z^0 232 // again. since we are working in char(p), the 233 // latter is guaranteed to be fulfilled. 234 long i = 0, ff = 1; 235 do 236 { 237 if ( i == a ) 238 return ff; 239 ff++; 240 i = gf_table[i]; 241 } while ( i != 0 ); 242 return -1; 243 } 244 } 245 224 246 int gf_gf2ff ( int a ) 225 247 { … … 244 266 } 245 267 246 bool gf_isff ( inta )268 bool gf_isff ( long a ) 247 269 { 248 270 if ( gf_iszero( a ) ) … … 254 276 } 255 277 } 278 279 bool gf_isff ( int a ) 280 { 281 if ( gf_iszero( a ) ) 282 return true; 283 else 284 { 285 // z^a in GF(p) iff (z^a)^p-1=1 286 return gf_isone( gf_power( a, gf_p - 1 ) ); 287 } 288 }
Note: See TracChangeset
for help on using the changeset viewer.