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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. BitWise operation Problem

BitWise operation Problem

Scheduled Pinned Locked Moved C#
help
4 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.
  • M Offline
    M Offline
    memoboy
    wrote on last edited by
    #1

    My problem is that i trye to move some bit's from one byte in spacific position to another byte in the same position EX. Byte :A = 11111111 Byte :B = 00000000 let us say that i want to move the last 4 bits in A to the last 4 bits in B my result should be A = 11111111 B = 00001111 :sigh: and thatnks verey much

    L 1 Reply Last reply
    0
    • M memoboy

      My problem is that i trye to move some bit's from one byte in spacific position to another byte in the same position EX. Byte :A = 11111111 Byte :B = 00000000 let us say that i want to move the last 4 bits in A to the last 4 bits in B my result should be A = 11111111 B = 00001111 :sigh: and thatnks verey much

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      byte result = (A & 0xf) | B; or B |= (A & 0xf); xacc-ide 0.0.7 now with C#, MSIL, C and HLSL coloring - Screenshots

      M 1 Reply Last reply
      0
      • L leppie

        byte result = (A & 0xf) | B; or B |= (A & 0xf); xacc-ide 0.0.7 now with C#, MSIL, C and HLSL coloring - Screenshots

        M Offline
        M Offline
        memoboy
        wrote on last edited by
        #3

        thanks you for your answer but i found a problem onit it give me a error message which say that the int cannt be converted to byte where is the problem here i try to solve it :confused: thanks again

        L 1 Reply Last reply
        0
        • M memoboy

          thanks you for your answer but i found a problem onit it give me a error message which say that the int cannt be converted to byte where is the problem here i try to solve it :confused: thanks again

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          try this then: B |= (byte)(A & 0xf); xacc-ide 0.0.8 now with C#, MSIL, C and HLSL coloring - Screenshots

          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