Skip to content

Commit

Permalink
Add crush_ln to calculate nature log efficently
Browse files Browse the repository at this point in the history
Crush_ln is a function that could calculate ln(x+1) * 4096, which is exactly maps [0,0xffff]
(corresponding to real numbers [1/0x10000, 1] to [0, 0xffff] (corresponding to real numbers
[-11.090355,0]).

It is architecture-independent, and runs in 22 to 52 cycles on a Core Duo (faster for longer inputs, slower for short inputs;
call overhead is not included).

It matches the crush_ln_table outputs in most cases, with differences of +/-1 in 4.35% of cases.

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
Signed-off-by: Anderson, Cristina S <cristina.s.anderson@intel.com>
  • Loading branch information
xiaoxichen819 authored and liewegas committed Jan 22, 2015
1 parent 0eca13d commit 32a1ead
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 6,592 deletions.
1 change: 1 addition & 0 deletions src/crush/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ noinst_HEADERS += \
crush/crush.h \
crush/grammar.h \
crush/hash.h \
crush/crush_ln_table.h \
crush/mapper.h \
crush/sample.txt \
crush/types.h
Expand Down
Loading

0 comments on commit 32a1ead

Please sign in to comment.