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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:56:39+00:00 2026-05-24T04:56:39+00:00

Given 3 different bytes such as say x = 64, y = 90, z

  • 0

Given 3 different bytes such as say x = 64, y = 90, z = 240 I am looking to concatenate them into say a string like 6490240. It would be lovely if this worked but it doesn’t:

 string xx = (string)x + (string)y + (string)z;

I am working in C++, and would settle for a concatenation of the bytes as a 24 bit string using their 8-bit representations.

It needs to be ultra fast because I am using this method on a lot of data, and it seems frustratingly like their isn’t a way to just say treat this byte as if it were a string.

Many thanks for your help

To clarify, the reason why I’m particular about using 3 bytes is because the original data pertains to RGB values which are read via pointers and are stored of course as bytes in memory.

I want a way really to treat each color independently so you can think of this as a hashing function if you like. So any fast representation that does it without collisions is desired. This is the only way I can think of to avoid any collisions at all.

  • 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-24T04:56:40+00:00Added an answer on May 24, 2026 at 4:56 am

    Did you consider instead just packing the color elements into three bytes of an integer?

    uint32_t full_color = (x << 16) | (y << 8) | z;

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

Sidebar

Related Questions

What are the potential pros and cons of each of these queries given different
I have been given two different Microsoft Word document that my virus scanner has
Given two interface references obtained from different sources. Is there a programmatic way to
Given the following code why am I getting different values for a and b
Given that there are many sizes and color depths for different phones (even for
Given a BehaviorSubject, what is the practical difference between calling all of these different
I have a set of different interfaces and I need to give them access
I use this code to encrypt a string (basically, this is the example given
I want write a repeating pattern of bytes into a block of memory. My
Given the following declaration: <Extension()> Public Function ToJSON(ByVal target As Object) As String Dim

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.