add bits function to util.c