<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/py/mpz.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>2017-12-29T03:05:48+00:00</updated>
<entry>
<title>py/mpz: Simplify handling of borrow and quo adjustment in mpn_div.</title>
<updated>2017-12-29T03:05:48+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-12-28T03:02:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=9766fddcdc29cb2b5a8657389b870703580a6e57'/>
<id>urn:sha1:9766fddcdc29cb2b5a8657389b870703580a6e57</id>
<content type='text'>
The motivation behind this patch is to remove unreachable code in mpn_div.
This unreachable code was added some time ago in
9a21d2e070c9ee0ef2c003f3a668e635c6ae4401, when a loop in mpn_div was copied
and adjusted to work when mpz_dig_t was exactly half of the size of
mpz_dbl_dig_t (a common case).  The loop was copied correctly but it wasn't
noticed at the time that the final part of the calculation of num-quo*den
could be optimised, and hence unreachable code was left for a case that
never occurred.

The observation for the optimisation is that the initial value of quo in
mpn_div is either exact or too large (never too small), and therefore the
subtraction of quo*den from num may subtract exactly enough or too much
(but never too little).  Using this observation the part of the algorithm
that handles the borrow value can be simplified, and most importantly this
eliminates the unreachable code.

The new code has been tested with DIG_SIZE=3 and DIG_SIZE=4 by dividing all
possible combinations of non-negative integers with between 0 and 3
(inclusive) mpz digits.
</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>py: Implement raising a big-int to a negative power.</title>
<updated>2017-07-25T01:49:22+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-07-25T01:49:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=04552ff71b6c722b21597d93481f024c72457cef'/>
<id>urn:sha1:04552ff71b6c722b21597d93481f024c72457cef</id>
<content type='text'>
Before this patch raising a big-int to a negative power would just return
0.  Now it returns a floating-point number with the correct value.
</content>
</entry>
<entry>
<title>py/mpz: Make mpz_is_zero() an inline function.</title>
<updated>2017-07-25T01:32:04+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-07-25T01:32:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4d1fb6107fdedb0dda8dfb1491c033bf731222c6'/>
<id>urn:sha1:4d1fb6107fdedb0dda8dfb1491c033bf731222c6</id>
<content type='text'>
It's more efficient as an inline function, and saves code size.
</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/mpz: Change type of "base" args from mp_uint_t to unsigned int.</title>
<updated>2017-02-16T05:51:16+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-02-16T04:59:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=6ed77bedbded21f4f3513b21fbb8b17a1f3e709e'/>
<id>urn:sha1:6ed77bedbded21f4f3513b21fbb8b17a1f3e709e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/mpz: Remove obsolete declaration of mpz_as_str_size.</title>
<updated>2017-02-16T05:51:16+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-02-16T04:55:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=eb90edb5c05dd613c144e2b66dd303f2248593e5'/>
<id>urn:sha1:eb90edb5c05dd613c144e2b66dd303f2248593e5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py/mpz: Convert mp_uint_t to size_t where appropriate.</title>
<updated>2017-02-16T05:51:13+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2017-02-16T04:50:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=dcdcc43dad0e1124a69e20fb6d008c7ffaf0e42a'/>
<id>urn:sha1:dcdcc43dad0e1124a69e20fb6d008c7ffaf0e42a</id>
<content type='text'>
</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/mpz: Implement mpz_set_from_bytes() as a foundation for int.from_bytes().</title>
<updated>2017-01-21T17:07:50+00:00</updated>
<author>
<name>Paul Sokolovsky</name>
<email>pfalcon@users.sourceforge.net</email>
</author>
<published>2017-01-21T17:07:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=1b42f5251fb126496584e2fc61fad12bca7f7152'/>
<id>urn:sha1:1b42f5251fb126496584e2fc61fad12bca7f7152</id>
<content type='text'>
</content>
</entry>
</feed>
