Commit Graph

20 Commits

Author SHA1 Message Date
Denys Vlasenko
d85352b4ff factor: fix stray semicolon
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-17 15:57:07 +02:00
Denys Vlasenko
8352b717ce factor: support "no-argvs" usage
function                                             old     new   delta
factorize_numstr                                       -      72     +72
packed_usage                                       31562   31566      +4
factor_main                                          109     101      -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 76/-8)              Total: 68 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-14 14:23:49 +02:00
Denys Vlasenko
107159ef1c factor: improve comments for sieving logic... also fix a typo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-13 13:38:16 +02:00
Denys Vlasenko
021d50405b factor: improve comments for sieving logic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-13 13:34:40 +02:00
Denys Vlasenko
c054822027 factor: tweak comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-13 10:51:13 +02:00
Denys Vlasenko
a976aaab0b factor: remove debug code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-11 07:50:42 +02:00
Denys Vlasenko
8a134ec680 libbb: move isqrt from factor, use it in diff too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-11 07:34:56 +02:00
Denys Vlasenko
10673c44f1 factor: much faster, and very slightly larger isqrt()
function                                             old     new   delta
isqrt_odd                                             70      88     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-11 07:02:42 +02:00
Denys Vlasenko
cc1f8ba489 factor: don't be too clever in isqrt - be small instead
function                                             old     new   delta
isqrt_odd                                            111      70     -41

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-10 18:30:35 +02:00
Denys Vlasenko
ad5394d591 factor: add code to test isqrt() correctness
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-10 13:53:57 +02:00
Denys Vlasenko
dd3a395053 factor: 25% faster sieving
function                                             old     new   delta
factorize                                            287     260     -27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-10 12:10:46 +02:00
Denys Vlasenko
4908c79a01 factor: better comments, slightl more clever conversion even->odd
function                                             old     new   delta
isqrt_odd                                            114     111      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-10 11:47:48 +02:00
Denys Vlasenko
f428f1dc6c factor: fix HALF_FMT usage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-10 10:13:14 +02:00
Denys Vlasenko
12dc4fbf18 factor: fix comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-10 00:41:11 +02:00
Denys Vlasenko
bef1713217 factor: a bit more simple isqrt
function                                             old     new   delta
isqrt_odd                                             87      80      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-10 00:28:26 +02:00
Denys Vlasenko
c6476dca54 factor: simpler isqrt
function                                             old     new   delta
isqrt_odd                                            102      87     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-10 00:24:16 +02:00
Denys Vlasenko
c804d4ec5c factor: factor2 variable is unused now, drop it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-09 23:19:47 +02:00
Denys Vlasenko
7e5f2f3b51 factor: expand comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-09 23:12:38 +02:00
Denys Vlasenko
1d232fd440 factor: 30% faster code (estimate max possible factor just once)
function                                             old     new   delta
factorize                                              -     161    +161
isqrt_odd                                              -     102    +102
factor_main                                          281     110    -171
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/1 up/down: 263/-171)           Total: 92 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-09 22:54:57 +02:00
Denys Vlasenko
ee7f75d94f factor: new applet
thus far only able to factor up to ULLONG_MAX

function                                             old     new   delta
factor_main                                            -     378    +378
packed_usage                                       31427   31502     +75
applet_names                                        2590    2597      +7
applet_main                                         1500    1504      +4
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/0 up/down: 464/0)             Total: 464 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-09 21:18:43 +02:00