Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Philogyny recapitulates erogeny; erogeny recapitulates philogyny.


devel / comp.arch / Non-adjacent signed integers

SubjectAuthor
o Non-adjacent signed integersThomas Koenig

1
Non-adjacent signed integers

<sbs2aq$l9b$1@newsreader4.netcologne.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18356&group=comp.arch#18356

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-30c8-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Non-adjacent signed integers
Date: Sun, 4 Jul 2021 10:25:30 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <sbs2aq$l9b$1@newsreader4.netcologne.de>
Injection-Date: Sun, 4 Jul 2021 10:25:30 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-30c8-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:30c8:0:7285:c2ff:fe6c:992d";
logging-data="21803"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sun, 4 Jul 2021 10:25 UTC

Not sure how relevant the non-adjacent form (aka canonical
signed digit representation) is to anybody here for the design of
multipliers or dividers. If not important to you, please skip.

Browsing OEIS, I recently stumbled across a rather easy and
fast algorithm to bring a number into canonical signed digit
form. Koren does not give it and Wikipedia didn't have an entry
under https://en.wikipedia.org/wiki/Non-adjacent_form until I put
it there a week ago, so I thought it might not be well known.

The following C function

void bin2naf (uint64_t x, uint64_t *np, uint64_t *nm)
{ uint64_t xh, x3, c;
xh = x >> 1;
x3 = x + xh;
c = xh ^ x3;
*np = x3 & c;
*nm = xh & c;
}

splits x into *np and *nm so that *np and *nm are the
positive part and the negative part of the non-adjacent
form, respectively. Origin and proof can be found at
http://math.colgate.edu/~integers/a8/a8.pdf .

The nice thing for hardware implementation is that this is
just a (presumably already highly optimzed) adder, an xor
and two separate ands.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor