Skip to content

Commit

Permalink
Using do_div() for 32-bit platforms.
Browse files Browse the repository at this point in the history
Thanks @panda-mute from GitHub.
  • Loading branch information
vel21ripn committed Jan 20, 2019
1 parent dfc2fc1 commit 23e3cbd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/third_party/src/lruc.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,15 @@ lruc *lruc_new(uint64_t cache_size, uint32_t average_length) {
perror("LRU Cache unable to create cache object");
return NULL;
}
cache->hash_table_size = cache_size / average_length;
cache->average_item_length = average_length;
cache->free_memory = cache_size;
cache->total_memory = cache_size;
#ifndef __KERNEL__
cache->hash_table_size = cache_size / average_length;
cache->seed = time(NULL);
#else
do_div(cache_size, average_length);
cache->hash_table_size = cache_size;
cache->seed = jiffies;
#endif

Expand Down

0 comments on commit 23e3cbd

Please sign in to comment.