I would like to use Gray-code for 2D space-filling-curve (SFC), e.g. for accessing linearized 2d array. So for this I would need two methods: