In an assignment involving cyclic shift hash codes, the instructions include the following code:

int hashCode(const char* p, int len) 
{ unsigned int h = 0;
  for (int i = 0; i < len; i++)
  { h = (h << 5)|(h >> 27);        
    h += (unsigned int)p[i];      
  return h;

What do the >> and << in line 4 mean?

Recommended Answers

All 2 Replies


Thanks a lot! Your link was really helpful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.