@@ -264,19 +264,17 @@ mod ct {
264
264
// conditions can be evaluated at compile-time. For now though it's cleaner to
265
265
// implement it 0this way, I think.
266
266
mod rt {
267
- enum flag {
268
- flag_left_justify ,
269
- flag_left_zero_pad ,
270
- flag_space_for_sign ,
271
- flag_sign_always ,
272
- flag_alternate ,
273
- }
267
+ const flag_none : u32 = 0u32 ;
268
+ const flag_left_justify : u32 = 0b00000000000000000000000000000001u32 ;
269
+ const flag_left_zero_pad : u32 = 0b00000000000000000000000000000010u32 ;
270
+ const flag_space_for_sign : u32 = 0b00000000000000000000000000000100u32 ;
271
+ const flag_sign_always : u32 = 0b00000000000000000000000000001000u32 ;
272
+ const flag_alternate : u32 = 0b00000000000000000000000000010000u32 ;
273
+
274
274
enum count { count_is( int ) , count_implied, }
275
275
enum ty { ty_default, ty_bits, ty_hex_upper, ty_hex_lower, ty_octal, }
276
276
277
- // FIXME (#1993): May not want to use a vector here for flags; instead
278
- // just use a bool per flag.
279
- type conv = { flags : [ flag ] /~, width : count , precision : count , ty: ty} ;
277
+ type conv = { flags : u32 , width : count , precision : count , ty: ty} ;
280
278
281
279
fn conv_int ( cv : conv , i : int ) -> str {
282
280
let radix = 10 u;
@@ -307,7 +305,6 @@ mod rt {
307
305
let s = if b { "true" } else { "false" } ;
308
306
// run the boolean conversion through the string conversion logic,
309
307
// giving it the same rules for precision, etc.
310
-
311
308
ret conv_str( cv, s) ;
312
309
}
313
310
fn conv_char ( cv : conv , c : char ) -> str {
@@ -430,9 +427,8 @@ mod rt {
430
427
}
431
428
ret padstr + s;
432
429
}
433
- fn have_flag ( flags : [ flag ] /~, f : flag ) -> bool {
434
- for vec:: each( flags) { |candidate| if candidate == f { ret true ; } }
435
- ret false ;
430
+ fn have_flag ( flags : u32 , f : u32 ) -> bool {
431
+ flags & f != 0
436
432
}
437
433
}
438
434
0 commit comments