Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16776

Re: Hints for writing bit-twiddling code in Python

From Serhiy Storchaka <storchaka@gmail.com>
Subject Re: Hints for writing bit-twiddling code in Python
Date 2011-12-07 11:33 +0200
References <4edee584$0$13933$c3e8da3$76491128@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.3375.1323250452.27778.python-list@python.org> (permalink)

Show all headers | View raw


07.12.11 06:03, Steven D'Aprano написав(ла):
> long newSeed = (seed&  0xFFFFFFFFL) * 0x41A7L;
> while (newSeed>= 0x80000000L) {
>      newSeed = (newSeed&  0x7FFFFFFFL) + (newSeed>>>  31L);
>      }
> seed = (newSeed == 0x7FFFFFFFL) ? 0 : (int)newSeed;

seed = (seed & 0xFFFFFFFF) * 0x41A7 % 0x7FFFFFFF

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Hints for writing bit-twiddling code in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-07 04:03 +0000
  Re: Hints for writing bit-twiddling code in Python Dan Stromberg <drsalists@gmail.com> - 2011-12-06 22:08 -0800
  Re: Hints for writing bit-twiddling code in Python Peter Otten <__peter__@web.de> - 2011-12-07 09:21 +0100
  Re: Hints for writing bit-twiddling code in Python Serhiy Storchaka <storchaka@gmail.com> - 2011-12-07 11:33 +0200

csiph-web