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. General Programming
  3. C / C++ / MFC
  4. Turbo code implementation in C++

Turbo code implementation in C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
4 Posts 3 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
    Manoj7390
    wrote on last edited by
    #1

    Hi everyone, I am trying to implement turbo encoder, i am not getting how to write the code for D-Flipflop because i am not getting how to access a single bit in C++. please help me out.. :)

    J 1 Reply Last reply
    0
    • M Manoj7390

      Hi everyone, I am trying to implement turbo encoder, i am not getting how to write the code for D-Flipflop because i am not getting how to access a single bit in C++. please help me out.. :)

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      In C/C++ single bits are acessed by using logical operators (and: &, or: |, xor: ^, not: ~) with masks with only one bit set. Additional bit operators are the shift left and right operators. An example would be counting the number of bits set in a variable:

      unsigned CountBits(unsigned nVal)
      {
      unsigned nCount = 0;
      while (nVal)
      {
      // test if lowest bit is set
      if (nVal & 1)
      ++nCount;
      // shift value right by one bit
      nVal >>= 1;
      }
      return nCount;
      }

      V 1 Reply Last reply
      0
      • J Jochen Arndt

        In C/C++ single bits are acessed by using logical operators (and: &, or: |, xor: ^, not: ~) with masks with only one bit set. Additional bit operators are the shift left and right operators. An example would be counting the number of bits set in a variable:

        unsigned CountBits(unsigned nVal)
        {
        unsigned nCount = 0;
        while (nVal)
        {
        // test if lowest bit is set
        if (nVal & 1)
        ++nCount;
        // shift value right by one bit
        nVal >>= 1;
        }
        return nCount;
        }

        V Offline
        V Offline
        vikramlinux
        wrote on last edited by
        #3

        Bit Field facility is available in C++ as well. http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=%2Fcom.ibm.vacpp6m.doc%2Flanguage%2Fref%2Fclrc03defbitf.htm[^]

        V 1 Reply Last reply
        0
        • V vikramlinux

          Bit Field facility is available in C++ as well. http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=%2Fcom.ibm.vacpp6m.doc%2Flanguage%2Fref%2Fclrc03defbitf.htm[^]

          V Offline
          V Offline
          vikramlinux
          wrote on last edited by
          #4

          ~ Or this may help. http://stackoverflow.com/questions/8054032/how-to-check-if-a-particular-bit-is-set-in-c-sharp[^]

          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