🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #12601

Re: % in hash table

#12601
From: Stefan Monnier
Date: Wed, 04 Oct 1995 09:18
15 lines
993 bytes
In article <44t2n7$oe1@bug.rahul.net>, Samuel P. Kho <samkho@rahul.net> wrote:
] could you describe how to take modulo-prime-number-1-less-than-2^n by
] few shifts and adds over mod 2^n?

The idea is the following (I'll use base 10 since you're not a computer):

(10000*x1 + 1000*x2 + 100*x3 + 10*x4 + x5) mod 99
= (x1 + 10*x2 + x3 + 10*x4 + x5) mod 99

For instance

1598309 mod 99 = (1 + 59 + 83 + 9) mod 99 = 152 mod 99 = (1 + 52) mod 99 = 53


	Stefan
Technical Details
Message-ID: <44tjge$heg@info.epfl.ch>
Path: arc1-ca.pugleaf.net!swidir.switch.ch!epflnews!not-for-mail
References: <43tqr6$3au@mikasa.iol.it> <jgkDFv094.JKJ@netcom.com> <44sjp4$c71@news.jf.intel.com> <44t2n7$oe1@bug.rahul.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!swidir.switch.ch!epflnews!not-for-mail
From: "Stefan Monnier" <stefan.monnier@epfl.ch>
Newsgroups: comp.arch,comp.arch.arithmetic,comp.lang.c
Subject: Re: % in hash table
Date: 4 Oct 1995 09:18:06 GMT
Organization: Ecole Polytechnique Federale de Lausanne
Message-ID: <44tjge$heg@info.epfl.ch>
References: <43tqr6$3au@mikasa.iol.it> <jgkDFv094.JKJ@netcom.com> <44sjp4$c71@news.jf.intel.com> <44t2n7$oe1@bug.rahul.net>
NNTP-Posting-Host: liasg9.epfl.ch
Originator: monnier@lia.di.epfl.ch (Stefan Monnier)