-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Addition of Bitset #87
Conversation
src/include/bitset.h
Outdated
enum cc_stat bitset_setbits_range (Bitset *bs, size_t l, size_t r); | ||
enum cc_stat bitset_unsetbits_range (Bitset *bs, size_t l, size_t r); | ||
enum cc_stat bitset_flipbits_range (Bitset *bs, size_t l, size_t r); | ||
enum cc_stat bitset_setbit_at (Bitset *bs, size_t position); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum cc_stat bitset_set_at(Bitset *bs, size_t index)
src/include/bitset.h
Outdated
|
||
enum cc_stat bitset_setbits_range (Bitset *bs, size_t l, size_t r); | ||
enum cc_stat bitset_unsetbits_range (Bitset *bs, size_t l, size_t r); | ||
enum cc_stat bitset_flipbits_range (Bitset *bs, size_t l, size_t r); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum cc_stat bitset_flip_range(Bitset *bs, size_t from, size_t to);
src/include/bitset.h
Outdated
void bitset_destroy (Bitset *bs); | ||
void bitset_destroy_free (Bitset *bs); | ||
|
||
enum cc_stat bitset_setbits_range (Bitset *bs, size_t l, size_t r); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum cc_stat bitset_set_range(Bitset *bs, size_t from, size_t to);
src/include/bitset.h
Outdated
void bitset_destroy_free (Bitset *bs); | ||
|
||
enum cc_stat bitset_setbits_range (Bitset *bs, size_t l, size_t r); | ||
enum cc_stat bitset_unsetbits_range (Bitset *bs, size_t l, size_t r); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum cc_stat bitset_unset_range(Bitset *bs, size_t from, size_t to);
src/include/bitset.h
Outdated
enum cc_stat bitset_unsetbits_range (Bitset *bs, size_t l, size_t r); | ||
enum cc_stat bitset_flipbits_range (Bitset *bs, size_t l, size_t r); | ||
enum cc_stat bitset_setbit_at (Bitset *bs, size_t position); | ||
enum cc_stat bitset_unsetbit_at (Bitset *bs, size_t position); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum cc_stat bitset_unset_at(Bitset *bs, size_t index);
src/include/bitset.h
Outdated
enum cc_stat bitset_and_operator (Bitset *bs1, Bitset *bs2); | ||
enum cc_stat bitset_or_operator (Bitset *bs1, Bitset *bs2); | ||
enum cc_stat bitset_xor_operator (Bitset *bs1, Bitset *bs2); | ||
enum cc_stat bitset_not_operator (Bitset *bs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum cc_stat bitset_not(Bitset *bs);
src/include/bitset.h
Outdated
enum cc_stat bitset_left_shift_cyclic (Bitset *bs); | ||
enum cc_stat bitset_right_shift (Bitset *bs); | ||
enum cc_stat bitset_right_shift_cyclic (Bitset *bs); | ||
int bitset_count_ones (Bitset *bs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size_t bitset_count_ones(Bitset *bs);
src/include/bitset.h
Outdated
enum cc_stat bitset_right_shift (Bitset *bs); | ||
enum cc_stat bitset_right_shift_cyclic (Bitset *bs); | ||
int bitset_count_ones (Bitset *bs); | ||
int bitset_count_zeros (Bitset *bs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size_t bitset_count_zeros(Bitset *bs);
src/include/bitset.h
Outdated
int bitset_count_zeros (Bitset *bs); | ||
enum cc_stat bitset_add (Bitset *bs1, Bitset *bs2, Bitset **out); | ||
enum cc_stat bitset_sub (Bitset *bs1, Bitset *bs2, Bitset **out); | ||
enum cc_stat bitset_multiply (Bitset *bs1, Bitset *bs2, Bitset **out); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't having names like multiply
and sub
a bit inconsistent? They should either both be abbreviated or not, but not mixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok got it
src/include/bitset.h
Outdated
enum cc_stat bitset_setbit_at (Bitset *bs, size_t position); | ||
enum cc_stat bitset_unsetbit_at (Bitset *bs, size_t position); | ||
enum cc_stat bitset_flipbit_at (Bitset *bs, size_t position); | ||
int bitset_getbit_at (Bitset *bs, size_t position); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is out of bounds error supposed to be handled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for out of bounds error i will return -1, otherwise if bit is unset its 0 else 1
I made the pull request, I didnt see the changes suggested, i saw them |
I do the given changes, and the work for the functions which i made like flip, unset etc is not over as i had not taken the care for the number of ones and zeros, i forgot that, that time, i do it too |
Now did it |
Oops error, i fix it |
Implemented and, or, not, xor functions |
First of all, I add definitions of the basic functions for the bitset, like creation, deletion, access of bits, manipulation of bits etc, @srdja please have a check, as soon the work for it will be completed I will merge it to the master, as you gave me the write access, or otherwise you can do it