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 7196047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:42:08+00:00 2026-05-28T20:42:08+00:00

I have a buffer of binary data: SInt16 *buffer = (SInt16 *)calloc(1024,sizeof(SInt16)); I want

  • 0

I have a buffer of binary data:

SInt16 *buffer = (SInt16 *)calloc(1024,sizeof(SInt16));

I want to process a chunk of data off the front of this buffer (for example 50 data points)

for(int i = 0; i < 50 ; ++i){
   process_data(buffer[i])
}

Once the data is processed I don’t need it any more, so I want to discard it and place my pointer *buffer at the 51st data point. However, I still need buffer to point to a buffer that has 1024 places in it. To do this I thought I would do a bit shift to do this because it accomplishes my goal and, to my knowledge, is quick (I’m in a high priority thread). However I’m unclear how bit shifting works with byte arrays.

First, if I want to shift the array such that *buffer points to the value formerly contained in buffer[50], is that a left or a right shift in C (Objective C)?

Second, if I shift buffer will it shift all 1024 data points or will it only shift one SInt16 datapoint at buffer[0]?

The idea here is that a processor will read chunks off the beginning of the buffer and then signal a file reader on another thread to append new data to the end of buffer. If 50 data points are processed, then those 50 points are discarded, and the file reader appends 50 new points of data to the end of the byte buffer.

  • 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-28T20:42:09+00:00Added an answer on May 28, 2026 at 8:42 pm

    Bit shifting has nothing to do with arrays / buffers.

    You could move the data around in the buffer via copying, but that’s incredibly inefficient.

    You really should think about using/implementing a circular buffer for this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So.. I have a buffer with MP3 data (If I would save this buffer
I want my emacs buffer to have a different name than the file name.
I have binary data in a file that I can read into a byte
I have an function which decodes the encoded base64 data in binary data but
I have a ~700 MB binary file (non-text data); what I would like to
I have an output evbuffer that I want to populate with the following data:
I have a instream that takes in raw binary data from Bluetooth on Android
I have a message object serialized as binary data stream (it can be any
I want to temporarily cache binary data before I can write it to a
Does Java have buffer overflows? If yes can you give me scenarios?

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.