1 << k shifts 1 left k places, in binary. i & (1 << k) returns a non-zero value if the kth bit in the number is set, but starting at 0! The expression is not quite ready to drop into your code: I suspect that it should be
for k in 0:d-1
if (i - 1) & (1 << (k - 1)) != 0
eval_pt[k] = u[k]
else
eval_pt[k] = v[k]
k_i += 1
end