The tilde operator in C

后端 未结 6 727
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-28 09:17

I\'ve seen the tilde operator used in the ELF hashing algorithm, and I\'m curious what it does. (The code is from Eternally Confused.)

unsigned elf_hash ( vo         


        
6条回答
  •  旧巷少年郎
    2020-11-28 09:46

    The ~ operator is bitwise NOT, it inverts the bits in a binary number:

    NOT 011100
      = 100011
    

提交回复
热议问题