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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:34:28+00:00 2026-06-15T09:34:28+00:00

I have a contiguous area of memory containing 320 bits divided into 10 independent

  • 0

I have a contiguous area of memory containing 320 bits divided into 10 independent “registers”.

Once I create the memory area, I get back the address of the first register element.

At this point, I want to logically map an array of 32 bit structs containing a high and low part of the 32 bit number, then iterate through the array and write the upper and lower segments separately.

I already have a function that will split and inputted 32 bit number into two 16 bit parts, using a bit rotation scheme.

My question is, what is the best way to overlay the array of structs over the contiguous area.

The reason why I need to do this is that I am using an external library to talk to an embedded device, and the library has no concept of 32 bits, even the underlying device stores data in 32 bit registers.

  • 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-06-15T09:34:34+00:00Added an answer on June 15, 2026 at 9:34 am

    First, make sure your struct is 32 bits as represented by the compiler. Check that sizeof(struct xxx) == 4 and play with the compiler packing options until it is (technically this ensures struct is 4 characters but it should be good enough)..

    Second is to just create a pointer to object of the struct type and then assign it the address of the memory block. You will need an old fashioned type-cast operation to do that.

    Something like (note the order of which is high and low and which bytes are which inside these will vary by hardware).

    typedef struct {
       short high;
       short low;
    } hilo;
    
    hilo *registers = (hilo *) memPtr;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 independent but contiguous date ranges. The first range is the start
I have an ESRI shape file containing a library of about 150 contiguous geographic
i have a program(winform) that runs through a lot of files(in the area of
Must a C++ implementation set the chars '0'-'9' to have contiguous numeric values, i.e.
I'm trying to select a subgroup of a list where items have contiguous dates,
Is it possible to have a contiguous link, where the text is normally underlined
I have a string which contains a contiguous chunk of digits and then a
I have to write an algorithm for Assigning Contiguous seats in a seat map.For
I am required to have multiple threads writing to a single buffer (contiguous chunk
Background: I have a sequence of contiguous, time-stamped data. The data-sequence has holes in

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.