Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6050121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:39:12+00:00 2026-05-23T07:39:12+00:00

I am writing some signal processing code in C that has a communications channel.

  • 0

I am writing some signal processing code in C that has a communications channel. At the output I get a bunch of bits as they arrive.

for (n=0; n<BUFFER_LENGTH; n++) {
    /* do some processing that calculates x */
    output[n] = x > 0;
}

Here are my questions:

  1. Is there a good type to represent
    the output array? At first I thought
    uint1_t would be ideal but I hear
    that doesn’t necessarily represent
    one bit in memory.
  2. Once I find a
    sync pattern in the data I know the
    format of the next bits, how can I
    convert a bunch of 1’s and 0’s in
    the array into integers, floats,
    doubles, characters, etc.? I’ve heard of using
    a union but I don’t think that will work with an
    array of bits.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:39:13+00:00Added an answer on May 23, 2026 at 7:39 am

    Just store the data in a sufficiently large block of bytes and then iterate through the bits using shifting and masking to extract individual bits sequentially.

    e.g. to print out the contents of a buffer as individual bits:

    #include <stdio.h>
    #include <stdint.h> // uint8_t et al
    #include <limits.h> // CHAR_BIT
    
    uint8_t buffer[256];
    int b, bit;
    
    for (b = 0; b < 256; ++b)
    {
        for (bit = CHAR_BIT - 1; bit >= 0; --bit)
        {
            uint8_t mask = 1 << bit;
            printf("%2d", (buffer[b] & mask) != 0);
        }
        printf("\n");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I was writing some code today that basically looks like this: string returnString
I am writing some signal processing software, and I am starting off by writing
i'm currently writing on some piece of code in android 2.1 that is supposed
I'm currently writing a C# application that does a lot of digital signal processing,
I'm writing some code that (I think) requires sequentially playing MovieClip objects. I would
While writing some C code, I decided to compile it to assembly and read
I'm writing some data acquisition software and need a gui plotting library that is
I am writing some code to determine whether a network domain is registered. For
Say I'm writing some ruby code and I want to use the standard Date
I'm writing some semi-portable code and want to be able to detect when I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.