X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_hashtable.c;h=612ae784780d078360f4d64864c9b5a5539e2dae;hb=c2e660b41f69c603b0c47f7c7572a22a2f601a51;hp=1d626cdb8a96cb67464565861d80e61390e04730;hpb=56f8088296ee4116a4811a2f4f843edd80a7748d;p=palacios.git diff --git a/palacios/src/palacios/vmm_hashtable.c b/palacios/src/palacios/vmm_hashtable.c index 1d626cd..612ae78 100644 --- a/palacios/src/palacios/vmm_hashtable.c +++ b/palacios/src/palacios/vmm_hashtable.c @@ -1,9 +1,37 @@ -/* Copyright (C) 2004 Christopher Clark */ -/* Modifications made by Jack Lange */ -/* (c) 2008, Jack Lange */ -/* (c) 2008, The V3VEE Project */ - +/* + Copyright (c) 2002, 2004, Christopher Clark + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the original author; nor the names of any contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/* Modifications made by Jack Lange */ @@ -97,7 +125,7 @@ ulong_t hash_long(ulong_t val, uint_t bits) { ulong_t hash_buffer(uchar_t * msg, uint_t length) { ulong_t hash = 0; ulong_t temp = 0; - int i; + uint_t i; for (i = 0; i < length; i++) { hash = (hash << 4) + *(msg + i) + i; @@ -205,7 +233,7 @@ struct hashtable * create_hashtable(uint_t min_size, htable->entry_count = 0; htable->hash_fn = hash_fn; htable->eq_fn = eq_fn; - htable->load_limit = (uint_t) ceil((double)(size * max_load_factor)); + htable->load_limit = (uint_t) v3_ceil((double)(size * max_load_factor)); return htable; } @@ -289,7 +317,7 @@ static int hashtable_expand(struct hashtable * htable) { htable->table_length = new_size; - htable->load_limit = (uint_t) ceil(new_size * max_load_factor); + htable->load_limit = (uint_t) v3_ceil(new_size * max_load_factor); return -1; }