Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. bitwise operator question

bitwise operator question

Scheduled Pinned Locked Moved JavaScript
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SuperRoo2
    wrote on last edited by
    #1

    Hi, came acoss this bit of code & don't fully understand it: Value <<= 1 as in if((Value <<= 1) <= 255)....... I know << is equivalent to XOR but does this mean: Value = Value << 1 if(Value <= 255)... or something else??? Also: value1 ^= value2.... is this equivalent to: value1 = value1 ^ value2 Some of these short cuts get me and do you think I can find out about <<=...try googling that. Any help appreciated

    Z 1 Reply Last reply
    0
    • S SuperRoo2

      Hi, came acoss this bit of code & don't fully understand it: Value <<= 1 as in if((Value <<= 1) <= 255)....... I know << is equivalent to XOR but does this mean: Value = Value << 1 if(Value <= 255)... or something else??? Also: value1 ^= value2.... is this equivalent to: value1 = value1 ^ value2 Some of these short cuts get me and do you think I can find out about <<=...try googling that. Any help appreciated

      Z Offline
      Z Offline
      ziggyfish
      wrote on last edited by
      #2

      << means bitshift left >> is bitshift right ^ is XOR. and a <operator>= b is the same as: a = a <operator> b

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups