x86: replace off-by-one OTMax

Message ID 5B44B58402000078001D2AC0@prv1-mh.provo.novell.com
State New
Headers show
Series
  • x86: replace off-by-one OTMax
Related show

Commit Message

Jan Beulich July 10, 2018, 1:32 p.m.
With its name it should equal to the largest prior enumerator, which is
not very helpful as that will change every once in a while. Rename it to
OTNum instead to make name and value match, and correct use sites to no
longer use one too large a value.

opcodes/
2018-07-10  Jan Beulich  <jbeulich@suse.com>

	* i386-opc.h: Rename OTMax to OTNum.
	(OTNumOfUints): Adjust calculation.
	(OTUnused): Directly alias to OTNum.

Comments

H.J. Lu July 10, 2018, 1:53 p.m. | #1
On Tue, Jul 10, 2018 at 6:32 AM, Jan Beulich <JBeulich@suse.com> wrote:
> With its name it should equal to the largest prior enumerator, which is

> not very helpful as that will change every once in a while. Rename it to

> OTNum instead to make name and value match, and correct use sites to no

> longer use one too large a value.

>

> opcodes/

> 2018-07-10  Jan Beulich  <jbeulich@suse.com>

>

>         * i386-opc.h: Rename OTMax to OTNum.

>         (OTNumOfUints): Adjust calculation.

>         (OTUnused): Directly alias to OTNum.

>

> --- a/opcodes/i386-opc.h

> +++ b/opcodes/i386-opc.h

> @@ -765,18 +765,18 @@ enum

>    /* Bound register.  */

>    RegBND,

>

> -  /* The last bitfield in i386_operand_type.  */

> -  OTMax

> +  /* The number of bitfields in i386_operand_type.  */

> +  OTNum

>  };

>

>  #define OTNumOfUints \

> -  (OTMax / sizeof (unsigned int) / CHAR_BIT + 1)

> +  ((OTNum - 1) / sizeof (unsigned int) / CHAR_BIT + 1)

>  #define OTNumOfBits \

>    (OTNumOfUints * sizeof (unsigned int) * CHAR_BIT)

>

>  /* If you get a compiler error for zero width of the unused field,

>     comment it out.  */

> -#define OTUnused               (OTMax + 1)

> +#define OTUnused               OTNum

>

>  typedef union i386_operand_type

>  {

>


OK.

Thanks.



-- 
H.J.

Patch

--- a/opcodes/i386-opc.h
+++ b/opcodes/i386-opc.h
@@ -765,18 +765,18 @@  enum
   /* Bound register.  */
   RegBND,
 
-  /* The last bitfield in i386_operand_type.  */
-  OTMax
+  /* The number of bitfields in i386_operand_type.  */
+  OTNum
 };
 
 #define OTNumOfUints \
-  (OTMax / sizeof (unsigned int) / CHAR_BIT + 1)
+  ((OTNum - 1) / sizeof (unsigned int) / CHAR_BIT + 1)
 #define OTNumOfBits \
   (OTNumOfUints * sizeof (unsigned int) * CHAR_BIT)
 
 /* If you get a compiler error for zero width of the unused field,
    comment it out.  */
-#define OTUnused		(OTMax + 1)
+#define OTUnused		OTNum
 
 typedef union i386_operand_type
 {