FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Python/wordcode_helpers.h at 3.6 · python/cpython · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
python
/
cpython
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
35.3k
Star
74.9k
Code
Issues
5k+
Pull requests
2.6k
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Python
/
wordcode_helpers.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
44 lines (41 loc) · 1.24 KB
Breadcrumbs
cpython
/
Python
/
wordcode_helpers.h
Copy path
File metadata and controls
44 lines (41 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
:
assert
(
0
);
}
}
Back
|
FazBrowse Home
|
New Git URL