Fix confusing if vec_len is bytes or number of elements

This commit is contained in:
Nils O. Selåsdal
2014-08-26 20:12:22 +02:00
parent 22f6c1e043
commit 7ed9bb298f
+2
View File
@@ -1,4 +1,5 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include "ucore/bitvec.h" #include "ucore/bitvec.h"
@@ -68,6 +69,7 @@ void uc_bv_set_bits_from_array(struct UCBitVec *v,char *array,size_t array_len)
for (i = 0; i < array_len; i++) { for (i = 0; i < array_len; i++) {
size_t idx = (size_t)bit_index(array_len); size_t idx = (size_t)bit_index(array_len);
if (unlikely(idx >= v->vec_len)) if (unlikely(idx >= v->vec_len))
break; break;