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#
  4. Please explain code!

Please explain code!

Scheduled Pinned Locked Moved C#
c++regexhelpquestion
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.
  • B Offline
    B Offline
    Brakanjan
    wrote on last edited by
    #1

    Hi I just started C++, but this code I found on the net blew me away. Could someone please help me understand, especially the lines market with a /**/. void read_data_from_bs(void *data, int bits_of_data, unsigned char *bit_stream, unsigned long & bit_offset) { int i; int n; while (bits_of_data > 0) { // <-- Colored with red by Instant Match n = bits_of_data > 8 ? 8 : bits_of_data; /**/ *(unsigned char *)data = 0; for (i = 0; i < n; i++) { if (read_bit(bit_stream, bit_offset)) { (*(unsigned char *)data) |= (1 << i); /**/ } bit_offset++ ; } data = ((unsigned char *)data) + 1; /**/ bits_of_data -= n; } }

    J 1 Reply Last reply
    0
    • B Brakanjan

      Hi I just started C++, but this code I found on the net blew me away. Could someone please help me understand, especially the lines market with a /**/. void read_data_from_bs(void *data, int bits_of_data, unsigned char *bit_stream, unsigned long & bit_offset) { int i; int n; while (bits_of_data > 0) { // <-- Colored with red by Instant Match n = bits_of_data > 8 ? 8 : bits_of_data; /**/ *(unsigned char *)data = 0; for (i = 0; i < n; i++) { if (read_bit(bit_stream, bit_offset)) { (*(unsigned char *)data) |= (1 << i); /**/ } bit_offset++ ; } data = ((unsigned char *)data) + 1; /**/ bits_of_data -= n; } }

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      C++ Forum[^]

      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