malloc: cast before bit operations on pointers