classification
Title: Add pycore_byteswap.h internal header file with _Py_bswap32() function
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pitrou, serhiy.storchaka, sir-sigurd, vstinner
Priority: normal Keywords: patch

Created on 2020-04-16 14:22 by vstinner, last changed 2020-05-10 19:30 by sir-sigurd. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19552 merged vstinner, 2020-04-16 14:23
PR 19572 merged vstinner, 2020-04-17 16:24
PR 19573 merged vstinner, 2020-04-17 16:25
PR 15659 sir-sigurd, 2020-05-10 19:30
Messages (7)
msg366600 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-16 14:22
There are multiple files which have to swap bytes. I propose to add functions for that:

* _Py_bswap16(): uint16_t
* _Py_bswap32(): uint32_t
* _Py_bswap64(): uint64_t
msg366603 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2020-04-16 14:48
Isn't pyport.h a public header?  IMHO you should put in a private header and make it an inline function there.

Here is for example what we do in Arrow:
https://github.com/apache/arrow/blob/master/cpp/src/arrow/util/bit_util.h#L48
msg366610 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-16 17:17
We have another function which may be grouped somehow in the same category: _Py_bit_length().
msg366659 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-17 15:47
New changeset 1ae035b7e847064d09df01ca62b8a761e9b5aae3 by Victor Stinner in branch 'master':
bpo-40302: Add pycore_byteswap.h header file (GH-19552)
https://github.com/python/cpython/commit/1ae035b7e847064d09df01ca62b8a761e9b5aae3
msg366667 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-17 17:13
New changeset 1a1bd2e23871619adc1405e1cdc7c1e61252fd2c by Victor Stinner in branch 'master':
bpo-40302: Replace PY_INT64_T with int64_t (GH-19573)
https://github.com/python/cpython/commit/1a1bd2e23871619adc1405e1cdc7c1e61252fd2c
msg366668 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-17 17:13
New changeset d7c657d4b121164caa439253da5266b2e29a1bed by Victor Stinner in branch 'master':
bpo-40302: UTF-32 encoder SWAB4() macro use a|b rather than a+b (GH-19572)
https://github.com/python/cpython/commit/d7c657d4b121164caa439253da5266b2e29a1bed
msg366669 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-17 17:15
FYI this issue was motivated by the implementation of random.Random().randbytes(): bpo-40286.
History
Date User Action Args
2020-05-10 19:30:18sir-sigurdsetnosy: + sir-sigurd

pull_requests: + pull_request19338
2020-04-17 17:15:00vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg366669

stage: patch review -> resolved
2020-04-17 17:13:38vstinnersetmessages: + msg366668
2020-04-17 17:13:10vstinnersetmessages: + msg366667
2020-04-17 16:40:12vstinnersettitle: Add pycore_byteswap.h header file with _Py_bswap32() function -> Add pycore_byteswap.h internal header file with _Py_bswap32() function
2020-04-17 16:40:06vstinnersettitle: Add _Py_bswap32() function to pyport.h -> Add pycore_byteswap.h header file with _Py_bswap32() function
2020-04-17 16:25:07vstinnersetpull_requests: + pull_request18913
2020-04-17 16:24:51vstinnersetpull_requests: + pull_request18912
2020-04-17 15:47:27vstinnersetmessages: + msg366659
2020-04-16 17:17:39vstinnersetmessages: + msg366610
2020-04-16 14:48:25pitrousetnosy: + pitrou
messages: + msg366603
2020-04-16 14:23:53vstinnersetnosy: + serhiy.storchaka
2020-04-16 14:23:28vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request18899
2020-04-16 14:22:55vstinnercreate