00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CU_WORDARR_H
00019 #define CU_WORDARR_H
00020
00021 #include <cu/fwd.h>
00022 #include <cu/bool.h>
00023 #include <cu/hash.h>
00024
00025 CU_BEGIN_DECLARATIONS
00026
00027
00028
00029 CU_SINLINE cu_bool_t
00030 cu_wordarr_eq(size_t count, cu_word_t const *arr0, cu_word_t const *arr1)
00031 {
00032 while (count--)
00033 if (*arr0++ != *arr1++)
00034 return cu_false;
00035 return cu_true;
00036 }
00037
00038
00039
00040 CU_SINLINE int
00041 cu_wordarr_cmp(size_t count, cu_word_t const *arr0, cu_word_t const *arr1)
00042 {
00043 while (count--) {
00044 cu_word_t w0 = *arr0++, w1 = *arr1++;
00045 if (w0 != w1)
00046 return w0 < w1? -1 : 1;
00047 }
00048 return 0;
00049 }
00050
00051
00052 CU_SINLINE void
00053 cu_wordarr_fill(size_t count, cu_word_t *dst, cu_word_t val)
00054 {
00055 while (count--)
00056 *dst++ = val;
00057 }
00058
00059
00060 CU_SINLINE void
00061 cu_wordarr_copy(size_t count, cu_word_t *dst, cu_word_t const *src)
00062 {
00063 while (count--) {
00064 *dst = *src;
00065 ++dst, ++src;
00066 }
00067 }
00068
00069
00070
00071 CU_SINLINE void
00072 cu_wordarr_copy_bitnot(size_t count, cu_word_t *dst, cu_word_t const *src)
00073 {
00074 while (count--) {
00075 *dst = ~*src;
00076 ++dst, ++src;
00077 }
00078 }
00079
00080
00081
00082 void cu_wordarr_copy_bitimg(cu_bool1f_t f, size_t count, cu_word_t *dst,
00083 cu_word_t const *src);
00084
00085
00086
00087
00088 void cu_wordarr_copy_bitimg2(cu_bool2f_t f, size_t count, cu_word_t *dst,
00089 cu_word_t const *src0, cu_word_t const *src1);
00090
00091
00092
00093
00094
00095 void cu_wordarr_skewcopy(size_t count, cu_word_t *dst,
00096 int src_offset, cu_word_t const *src);
00097
00098
00099
00100 void cu_wordarr_skewcopy_bitnot(size_t count, cu_word_t *dst,
00101 int src_offset, cu_word_t const *src);
00102
00103
00104
00105 void cu_wordarr_skewcopy_bitimg(cu_bool1f_t f, size_t count, cu_word_t *dst,
00106 int src_offset, cu_word_t const *src);
00107
00108
00109
00110
00111 void cu_wordarr_skewcopy_bitimg2(cu_bool2f_t f, size_t count, cu_word_t *dst,
00112 int offset0, cu_word_t const *src0,
00113 int offset1, cu_word_t const *src1);
00114
00115 #define cu_wordarr_hash cu_wordarr_hash_bj
00116
00117 CU_END_DECLARATIONS
00118
00119 #endif