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

  • Home
  • SEARCH
  • 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 6213909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:46:52+00:00 2026-05-24T06:46:52+00:00

I have BASIC logical question about the following code snippet: 1 uint64_t RMTileKey(RMTile tile)

  • 0

I have BASIC logical question about the following code snippet:

1     uint64_t RMTileKey(RMTile tile)
2    {
3            uint64_t zoom = (uint64_t) tile.zoom & 0xFFLL; // 8bits, 256 levels
4            uint64_t x = (uint64_t) tile.x & 0xFFFFFFFLL;  // 28 bits
5            uint64_t y = (uint64_t) tile.y & 0xFFFFFFFLL;  // 28 bits
6    
7       uint64_t key = (zoom << 56) | (x << 28) | (y << 0);
8    
9       return key;
10    }

The return value key is an unsigned integer.
I am very confused now, because i dont understand what is happening in line 3(4,5). The operator & does what with my uint64_t. I guess it is converting to a hex-value ?
And then in line 7 i shift from bit 0 to 27 (28 to 56 …) and merge theses hex-based numbers?

  • 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-24T06:46:54+00:00Added an answer on May 24, 2026 at 6:46 am

    line 3: zoom has all the bits except 0 to 7 clear: 0000...000zzzzzzzz 8 bits

    line 4: x has all the bits except 0 to 27 clear: 0000...000xxxx...xxxx; 28 bits

    line 5: y has all the bits except 0 to 27 clear: 0000...000yyyy...yyyy; 28 bits

    line 7: the bits are rearranged to make a single 64-bit value:

             ,--------------------- bit 56
            /          ,----------- bit 28
           /          /          ,- bit 0
    zzzzzzzzxxxx...xxxxyyyy...yyyy
    zoom<<56   x<<28      y<<0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a quick question about using logical operators in an if statement. Currently
I have basic question about mysqli prepared statements. For example, I want to execute
I have a basic ajax application, which will not work, instead the php code
Currently, i have basic C++ and PHP skills. But, i want to switch to
I have a basic form with controls that are databound to an object implementing
I have a basic understanding of mock and fake objects, but I'm not sure
I have a basic CRUD form that uses PageMethods to update the user details,
I have a basic model in which i have specified some of the fields
I have a basic ActiveRecord model in which i have two fields that i
I have a basic cs-major understanding of multi-threading but have never had to do

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.