0

I recently saw that representation in here: https://en.wikipedia.org/wiki/Modular_exponentiation#Right-to-left_binary_method

'exponent := exponent >> 1'

what does it mean?

D. Johnson
  • 25
  • 4

3 Answers3

1

It is actually a right-shift operator.

Right-shifting a number by 1 is the same as dividing it by two.

CinCout
  • 9,486
  • 12
  • 49
  • 67
0

That looks like shift right (which effectively divides by two).

It's a bit odd that the example uses mod and >>. I'd expect & 1 and >> 1 or mod 2 and / 2 for consistency

Stefan Haustein
  • 18,427
  • 3
  • 36
  • 51
0

I would guess that it can be right bit shift like in C. Please see this page for further explanation of this this operator.

Karzmu
  • 142
  • 1
  • 9