diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/tools/python3/src/Python/wordcode_helpers.h | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Python/wordcode_helpers.h')
-rw-r--r-- | contrib/tools/python3/src/Python/wordcode_helpers.h | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/contrib/tools/python3/src/Python/wordcode_helpers.h b/contrib/tools/python3/src/Python/wordcode_helpers.h index c8f7a0f41f..53f79f50f2 100644 --- a/contrib/tools/python3/src/Python/wordcode_helpers.h +++ b/contrib/tools/python3/src/Python/wordcode_helpers.h @@ -1,44 +1,44 @@ -/* This file contains code shared by the compiler and the peephole - optimizer. - */ - -#ifdef WORDS_BIGENDIAN -# define PACKOPARG(opcode, oparg) ((_Py_CODEUNIT)(((opcode) << 8) | (oparg))) -#else -# define PACKOPARG(opcode, oparg) ((_Py_CODEUNIT)(((oparg) << 8) | (opcode))) -#endif - -/* Minimum number of code units necessary to encode instruction with - EXTENDED_ARGs */ -static int -instrsize(unsigned int oparg) -{ - return oparg <= 0xff ? 1 : - oparg <= 0xffff ? 2 : - oparg <= 0xffffff ? 3 : - 4; -} - -/* Spits out op/oparg pair using ilen bytes. codestr should be pointed at the - desired location of the first EXTENDED_ARG */ -static void -write_op_arg(_Py_CODEUNIT *codestr, unsigned char opcode, - unsigned int oparg, int ilen) -{ - switch (ilen) { - case 4: - *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 24) & 0xff); - /* fall through */ - case 3: - *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 16) & 0xff); - /* fall through */ - case 2: - *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 8) & 0xff); - /* fall through */ - case 1: - *codestr++ = PACKOPARG(opcode, oparg & 0xff); - break; - default: - Py_UNREACHABLE(); - } -} +/* This file contains code shared by the compiler and the peephole + optimizer. + */ + +#ifdef WORDS_BIGENDIAN +# define PACKOPARG(opcode, oparg) ((_Py_CODEUNIT)(((opcode) << 8) | (oparg))) +#else +# define PACKOPARG(opcode, oparg) ((_Py_CODEUNIT)(((oparg) << 8) | (opcode))) +#endif + +/* Minimum number of code units necessary to encode instruction with + EXTENDED_ARGs */ +static int +instrsize(unsigned int oparg) +{ + return oparg <= 0xff ? 1 : + oparg <= 0xffff ? 2 : + oparg <= 0xffffff ? 3 : + 4; +} + +/* Spits out op/oparg pair using ilen bytes. codestr should be pointed at the + desired location of the first EXTENDED_ARG */ +static void +write_op_arg(_Py_CODEUNIT *codestr, unsigned char opcode, + unsigned int oparg, int ilen) +{ + switch (ilen) { + case 4: + *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 24) & 0xff); + /* fall through */ + case 3: + *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 16) & 0xff); + /* fall through */ + case 2: + *codestr++ = PACKOPARG(EXTENDED_ARG, (oparg >> 8) & 0xff); + /* fall through */ + case 1: + *codestr++ = PACKOPARG(opcode, oparg & 0xff); + break; + default: + Py_UNREACHABLE(); + } +} |