]> gitweb.factorcode.org Git - factor.git/blob - extra/crypto/barrett/barrett.factor
Fix comments to be ! not #!.
[factor.git] / extra / crypto / barrett / barrett.factor
1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel math math.functions ;
4 IN: crypto.barrett
5
6 : barrett-mu ( n size -- mu )
7     ! Calculates Barrett's reduction parameter mu
8     ! size = word size in bits (8, 16, 32, 64, ...)
9     [ [ log2 1 + ] [ / 2 * ] bi* ]
10     [ 2^ rot ^ swap /i ] 2bi ;