Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1980)

Unified Diff: cgen/templates/inlined/PyRangeIter_Type

Issue 14757: INCA: Inline Caching meets Quickening in Python 3.3
Patch Set: Created 1 year ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cgen/templates/inlined/PyLong_Type ('k') | cgen/templates/instr-targets.h.impl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cgen/templates/inlined/PyRangeIter_Type Fri May 11 16:21:51 2012 -0700
@@ -0,0 +1,23 @@
+ {
+ typedef struct {
+ PyObject_HEAD
+ long index;
+ long start;
+ long step;
+ long len;
+ } rangeiterobject;
+
+ if (((rangeiterobject*)v)->index < ((rangeiterobject*)v)->len) {
+ /* cast to unsigned to avoid possible signed overflow
+ in intermediate calculations. */
+ x= PyLong_FromLong((long)(((rangeiterobject*)v)->start +
+ (unsigned long)(((rangeiterobject*)v)->index++)
+ * ((rangeiterobject*)v)->step));
+ PUSH(x);
+ DISPATCH();
+ }
+ else {
+ x = NULL;
+ goto FOR_ITER_CONTINUE;
+ } // if
+ }
« no previous file with comments | « cgen/templates/inlined/PyLong_Type ('k') | cgen/templates/instr-targets.h.impl » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7