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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:07:17+00:00 2026-05-26T06:07:17+00:00

word color; crap = ((color & 0xffc0) >> 1) | (color & 0x1f) I

  • 0
word color;

crap = ((color & 0xffc0) >> 1) | (color & 0x1f)

I have this shifting code. I have no idea what the purpose is of this code, but I suspect it has something to do with switching between 555 to 565 colors.

How would I create a function that does the exact opposite as the code above? That converts the variable back to the original color number?

  • 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-26T06:07:18+00:00Added an answer on May 26, 2026 at 6:07 am

    I suspect it has something to do with switching between 555 to 565 colors.

    Yes, that’s what it’s doing. color will be the 565 representation, and crap the corresponding 555 representation.

    Lets look at what each operation does. I’ll refer to the three fields as a (5 bits), b (6 bits, transformed to 5) and c (5 bits).

    (color & 0xffc0) clears the bottom 6 bits of the word, removing c and the least significant bit of b, preserving a and the most significant 5 bits of b.

    >> 1 shifts these bits right, so we now have a (5 bits), b (5 bits), and an empty 5-bit field.

    (color & 0x1f) clears all the bits except for the bottom 5 bits – that is, it preserves ‘c’ and removes the other fields.

    Finally, | combines the two values, giving a and b from the left-hand side, and c from the right-hand side, each in 5 bits.

    How would I create a function that does the exact opposite as the code above? That converts the variable back to the original color number?

    color = ((crap & 0xffe0) << 1) | (crap & 0x1f);
    

    Note that the least significant bit of b is now zero, whatever it was to start with. That information was lost in the first transformation, and can’t be recovered.

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

Sidebar

Related Questions

This code changes the color of the first word found in that class. Works
I don't want word wrap but this is being. I have set width more
I have a VBA Word Macro that gets words from .txt list and color
Do you have an idea to add a background-color property on a multi-line text,
I'm having a hard time how to align the Word Code ein in this
I am currently using this JavaScript to change the color of the second word
Has anyone tried to change the font formatting(bold/italic/color) of a selected word or sentence
This is my code: <div style=position:absolute;top:300px;width:50px;height:50px;background:red;color:black;word-wrap:break-word;> <div contenteditable=true> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aaaaa bbbbbbbbbbb </div> </div>
So I wanted to make every word in the text different color, but I've
Is it possible to have a textview to have different color for every word?

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.