<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/objint.h, branch 5.3.x</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=5.3.x</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=5.3.x'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2019-05-12T04:10:53+00:00</updated>
<entry>
<title>Handle truth values; speed up smallint checks</title>
<updated>2019-05-12T04:10:53+00:00</updated>
<author>
<name>Dan Halbert</name>
<email>halbert@halwitz.org</email>
</author>
<published>2019-05-12T04:10:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=d103ac1d6325a075be3fafe812858584435f3144'/>
<id>urn:sha1:d103ac1d6325a075be3fafe812858584435f3144</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add overflow checks for int to bytes conversions</title>
<updated>2019-05-09T07:22:25+00:00</updated>
<author>
<name>Matt Wozniski</name>
<email>godlygeek+git@gmail.com</email>
</author>
<published>2019-05-09T03:50:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=095c844004bcd8680a4bf68901adbd9cac6a4302'/>
<id>urn:sha1:095c844004bcd8680a4bf68901adbd9cac6a4302</id>
<content type='text'>
For both small and long integers, raise an exception if calling
struct.pack, adding an element to an array.array, or formatting an int
with int.to_bytes would overflow the requested size.
</content>
</entry>
<entry>
<title>py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS.</title>
<updated>2017-09-17T21:06:43+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-09-17T21:06:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9dce823cfd0a9991350184f08a1373f3887134f4'/>
<id>urn:sha1:9dce823cfd0a9991350184f08a1373f3887134f4</id>
<content type='text'>
This allows user classes to implement __abs__ special method, and saves
code size (104 bytes for x86_64), even though during refactor, an issue
was fixed and few optimizations were made:

* abs() of minimum (negative) small int value is calculated properly.
* objint_longlong and objint_mpz avoid allocating new object is the
  argument is already non-negative.
</content>
</entry>
<entry>
<title>all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate</title>
<updated>2017-08-29T03:16:30+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-08-29T03:04:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=58321dd9854d71a96e5db2d361e0efc05d9de8cf'/>
<id>urn:sha1:58321dd9854d71a96e5db2d361e0efc05d9de8cf</id>
<content type='text'>
The unary-op/binary-op enums are already defined, and there are no
arithmetic tricks used with these types, so it makes sense to use the
correct enum type for arguments that take these values.  It also reduces
code size quite a bit for nan-boxing builds.
</content>
</entry>
<entry>
<title>all: Use the name MicroPython consistently in comments</title>
<updated>2017-07-31T08:35:40+00:00</updated>
<author>
<name>Alexander Steffen</name>
<email>devel.20.webmeister@spamgourmet.com</email>
</author>
<published>2017-06-30T07:22:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=55f33240f3d7051d4213629e92437a36f1fac50e'/>
<id>urn:sha1:55f33240f3d7051d4213629e92437a36f1fac50e</id>
<content type='text'>
There were several different spellings of MicroPython present in comments,
when there should be only one.
</content>
</entry>
<entry>
<title>all: Unify header guard usage.</title>
<updated>2017-07-18T01:57:39+00:00</updated>
<author>
<name>Alexander Steffen</name>
<email>devel.20.webmeister@spamgourmet.com</email>
</author>
<published>2017-06-29T21:14:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=299bc625864b9e624ed599c94a5f95870516139a'/>
<id>urn:sha1:299bc625864b9e624ed599c94a5f95870516139a</id>
<content type='text'>
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.

This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.

The rules are as follows.

Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _

In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.

py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
</content>
</entry>
<entry>
<title>py/objint: Consolidate mp_obj_new_int_from_float to one implementation.</title>
<updated>2017-04-04T06:45:49+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-04-04T06:45:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=fc245d1ca4367f9876ac32c7e08e169da7db79b9'/>
<id>urn:sha1:fc245d1ca4367f9876ac32c7e08e169da7db79b9</id>
<content type='text'>
This reduces code duplication and allows to make mp_classify_fp_as_int
static, which reduces code size.
</content>
</entry>
<entry>
<title>py: Added optimised support for 3-argument calls to builtin.pow()</title>
<updated>2017-02-02T19:23:10+00:00</updated>
<author>
<name>Nicko van Someren</name>
<email>nicko@nicko.org</email>
</author>
<published>2017-02-01T23:41:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=df0117c8ae213a0652c3b19a969edc7fd994eeab'/>
<id>urn:sha1:df0117c8ae213a0652c3b19a969edc7fd994eeab</id>
<content type='text'>
Updated modbuiltin.c to add conditional support for 3-arg calls to
pow() using MICROPY_PY_BUILTINS_POW3 config parameter. Added support in
objint_mpz.c for for optimised implementation.
</content>
</entry>
<entry>
<title>py/objint: from_bytes(): Implement "byteorder" param and arbitrary precision.</title>
<updated>2017-01-21T17:14:18+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-01-21T17:14:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=bec7bfb29d76f995dbf223c20f5d04ae1e33cee6'/>
<id>urn:sha1:bec7bfb29d76f995dbf223c20f5d04ae1e33cee6</id>
<content type='text'>
If result guaranteedly fits in a small int, it is handled in objint.c.
Otherwise, it is delegated to mp_obj_int_from_bytes_impl(), which should
be implemented by individual objint_*.c, similar to
mp_obj_int_to_bytes_impl().
</content>
</entry>
<entry>
<title>py/objint: Rename mp_obj_int_as_float to mp_obj_int_as_float_impl.</title>
<updated>2016-12-21T00:46:27+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2016-12-21T00:46:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=e4af71212550d950269f6991be187f41dcf64eee'/>
<id>urn:sha1:e4af71212550d950269f6991be187f41dcf64eee</id>
<content type='text'>
And also simplify it to remove the check for small int.  This can be done
because this function is only ever called if the argument is not a small
int.
</content>
</entry>
</feed>
