@@ -55,7 +55,7 @@ macro_rules! all_opcodes {
5555 /// Empty stack is also `FALSE`.
5656 pub const OP_FALSE : Opcode = OP_PUSHBYTES_0 ;
5757 /// Number 1 is also TRUE.
58- pub const OP_TRUE : Opcode = OP_PUSHNUM_1 ;
58+ pub const OP_TRUE : Opcode = OP_1 ;
5959 /// Previously called `OP_NOP2`.
6060 pub const OP_NOP2 : Opcode = OP_CLTV ;
6161 /// Previously called `OP_NOP3`.
@@ -454,8 +454,8 @@ impl Opcode {
454454 ( OP_1NEGATE , _) => Class :: PushNum ( -1 ) ,
455455
456456 // 16 opcodes of PushNum class
457- ( op, _) if op. code >= OP_PUSHNUM_1 . code && op. code <= OP_PUSHNUM_16 . code =>
458- Class :: PushNum ( 1 + i32:: from ( self . code ) - i32:: from ( OP_PUSHNUM_1 . code ) ) ,
457+ ( op, _) if op. code >= OP_1 . code && op. code <= OP_16 . code =>
458+ Class :: PushNum ( 1 + i32:: from ( self . code ) - i32:: from ( OP_1 . code ) ) ,
459459
460460 // 76 opcodes of PushBytes class
461461 ( op, _) if op. code <= OP_PUSHBYTES_75 . code => Class :: PushBytes ( u32:: from ( self . code ) ) ,
@@ -471,16 +471,16 @@ impl Opcode {
471471
472472 /// Decodes PUSHNUM [`Opcode`] as a `u8` representing its number (1-16).
473473 ///
474- /// Does not convert `OP_FALSE` to 0. Only `1` to `OP_PUSHNUM_16 ` are covered.
474+ /// Does not convert `OP_FALSE` to 0. Only `1` to `OP_16 ` are covered.
475475 ///
476476 /// # Returns
477477 ///
478478 /// Returns `None` if `self` is not a PUSHNUM.
479479 #[ inline]
480480 #[ must_use]
481481 pub const fn decode_pushnum ( self ) -> Option < u8 > {
482- const START : u8 = OP_PUSHNUM_1 . code ;
483- const END : u8 = OP_PUSHNUM_16 . code ;
482+ const START : u8 = OP_1 . code ;
483+ const END : u8 = OP_16 . code ;
484484 match self . code {
485485 START ..=END => Some ( self . code - START + 1 ) ,
486486 _ => None ,
@@ -633,11 +633,11 @@ mod tests {
633633 fn decode_pushnum ( ) {
634634 // Test all possible opcodes
635635 // - Sanity check
636- assert_eq ! ( OP_PUSHNUM_1 . code, 0x51_u8 ) ;
637- assert_eq ! ( OP_PUSHNUM_16 . code, 0x60_u8 ) ;
636+ assert_eq ! ( OP_1 . code, 0x51_u8 ) ;
637+ assert_eq ! ( OP_16 . code, 0x60_u8 ) ;
638638 for i in 0x00 ..=0xff_u8 {
639639 let expected = match i {
640- // OP_PUSHNUM_1 ..= OP_PUSHNUM_16
640+ // OP_1 ..= OP_16
641641 0x51 ..=0x60 => Some ( i - 0x50 ) ,
642642 _ => None ,
643643 } ;
@@ -647,22 +647,22 @@ mod tests {
647647 // Test the named opcode constants
648648 // - This is the OP right before PUSHNUMs start
649649 assert ! ( OP_RESERVED . decode_pushnum( ) . is_none( ) ) ;
650- assert_eq ! ( OP_PUSHNUM_1 . decode_pushnum( ) . expect( "pushnum" ) , 1 ) ;
651- assert_eq ! ( OP_PUSHNUM_2 . decode_pushnum( ) . expect( "pushnum" ) , 2 ) ;
652- assert_eq ! ( OP_PUSHNUM_3 . decode_pushnum( ) . expect( "pushnum" ) , 3 ) ;
653- assert_eq ! ( OP_PUSHNUM_4 . decode_pushnum( ) . expect( "pushnum" ) , 4 ) ;
654- assert_eq ! ( OP_PUSHNUM_5 . decode_pushnum( ) . expect( "pushnum" ) , 5 ) ;
655- assert_eq ! ( OP_PUSHNUM_6 . decode_pushnum( ) . expect( "pushnum" ) , 6 ) ;
656- assert_eq ! ( OP_PUSHNUM_7 . decode_pushnum( ) . expect( "pushnum" ) , 7 ) ;
657- assert_eq ! ( OP_PUSHNUM_8 . decode_pushnum( ) . expect( "pushnum" ) , 8 ) ;
658- assert_eq ! ( OP_PUSHNUM_9 . decode_pushnum( ) . expect( "pushnum" ) , 9 ) ;
659- assert_eq ! ( OP_PUSHNUM_10 . decode_pushnum( ) . expect( "pushnum" ) , 10 ) ;
660- assert_eq ! ( OP_PUSHNUM_11 . decode_pushnum( ) . expect( "pushnum" ) , 11 ) ;
661- assert_eq ! ( OP_PUSHNUM_12 . decode_pushnum( ) . expect( "pushnum" ) , 12 ) ;
662- assert_eq ! ( OP_PUSHNUM_13 . decode_pushnum( ) . expect( "pushnum" ) , 13 ) ;
663- assert_eq ! ( OP_PUSHNUM_14 . decode_pushnum( ) . expect( "pushnum" ) , 14 ) ;
664- assert_eq ! ( OP_PUSHNUM_15 . decode_pushnum( ) . expect( "pushnum" ) , 15 ) ;
665- assert_eq ! ( OP_PUSHNUM_16 . decode_pushnum( ) . expect( "pushnum" ) , 16 ) ;
650+ assert_eq ! ( OP_1 . decode_pushnum( ) . expect( "pushnum" ) , 1 ) ;
651+ assert_eq ! ( OP_2 . decode_pushnum( ) . expect( "pushnum" ) , 2 ) ;
652+ assert_eq ! ( OP_3 . decode_pushnum( ) . expect( "pushnum" ) , 3 ) ;
653+ assert_eq ! ( OP_4 . decode_pushnum( ) . expect( "pushnum" ) , 4 ) ;
654+ assert_eq ! ( OP_5 . decode_pushnum( ) . expect( "pushnum" ) , 5 ) ;
655+ assert_eq ! ( OP_6 . decode_pushnum( ) . expect( "pushnum" ) , 6 ) ;
656+ assert_eq ! ( OP_7 . decode_pushnum( ) . expect( "pushnum" ) , 7 ) ;
657+ assert_eq ! ( OP_8 . decode_pushnum( ) . expect( "pushnum" ) , 8 ) ;
658+ assert_eq ! ( OP_9 . decode_pushnum( ) . expect( "pushnum" ) , 9 ) ;
659+ assert_eq ! ( OP_10 . decode_pushnum( ) . expect( "pushnum" ) , 10 ) ;
660+ assert_eq ! ( OP_11 . decode_pushnum( ) . expect( "pushnum" ) , 11 ) ;
661+ assert_eq ! ( OP_12 . decode_pushnum( ) . expect( "pushnum" ) , 12 ) ;
662+ assert_eq ! ( OP_13 . decode_pushnum( ) . expect( "pushnum" ) , 13 ) ;
663+ assert_eq ! ( OP_14 . decode_pushnum( ) . expect( "pushnum" ) , 14 ) ;
664+ assert_eq ! ( OP_15 . decode_pushnum( ) . expect( "pushnum" ) , 15 ) ;
665+ assert_eq ! ( OP_16 . decode_pushnum( ) . expect( "pushnum" ) , 16 ) ;
666666 // - This is the OP right after PUSHNUMs end
667667 assert ! ( OP_NOP . decode_pushnum( ) . is_none( ) ) ;
668668 }
0 commit comments