fcppt::container::bitfield::proxy<StoredType>::operator fcppt::container::bitfield::value_type() const { return ( array_[array_offset(pos_)] & (1u << (bit_offset(pos_))) ) != 0u; }
int main(int argc, char* argv[]) { int arrayinfo[] = {3, 4, 6, 1, 5, -3, 3}; printf("offset = %d\n", array_offset(arrayinfo, 4, 1, -3)); printf("offset = %d\n", array_offset(arrayinfo, 4, 2, -3)); printf("offset = %d\n", array_offset(arrayinfo, 4, 1, -1)); printf("offset = %d\n", array_offset(arrayinfo, 5, 1, -3)); printf("offset = %d\n", array_offset(arrayinfo, 4, 3, -3)); printf("offset = %d\n", array_offset(arrayinfo, 5, 3, -1)); printf("offset = %d\n", array_offset(arrayinfo, 6, 1, -3)); printf("offset = %d\n", array_offset(arrayinfo, 4, 1, -2)); printf("offset = %d\n", array_offset(arrayinfo, 6, 5, 3)); return EXIT_SUCCESS; }
int main() { int* information = NULL; information = (int*)malloc(SIZEOFINFO*sizeof(int)); information[0] = 3; information[1] = 4; information[2] = 6; information[3] = 1; information[4] = 5; information[5] = -3; information[6] = 3; printf("The shifting is : %d",array_offset(information,5,3,-1) ); return 0; }
int main(int argc, char *argv[]) { // Copied from https://github.com/dielew/pts_on_c/blob/master/p8_8_6.c int arrayinfo[10] = {3, 4, 6, 1, 5, -3, 3}; printf("%d\n", array_offset(arrayinfo, 4, 1, -3)); printf("%d\n", array_offset(arrayinfo, 4, 1, -2)); printf("%d\n", array_offset(arrayinfo, 4, 1, 3)); printf("%d\n", array_offset(arrayinfo, 4, 2, -3)); printf("%d\n", array_offset(arrayinfo, 5, 1, -3)); printf("%d\n", array_offset(arrayinfo, 6, 3, 1)); return 0; }
void main(void){ int offset[5]={2,3,7,2,8}; int ans=array_offset(offset,4,6); printf("ans=%i\n",ans ); }