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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:46:25+00:00 2026-05-19T04:46:25+00:00

for the transposition table (generally a hash table) of a Connect Four game, I

  • 0

for the transposition table (generally a hash table) of a Connect Four
game, I would like to use the memory efficiently (to store the most possible
number of elements). One table element has to store following information:

  • lock: unsigned 64 bit
  • move: [0..6] –> unsigned 3 bit
  • score: [-2000..2000] –> signed 12 bit
  • flag: VALID, UBOUND, LBOUND: –> unsigned 2 bit
  • height: [-1..42]: –> signed 7 bit

First I tried following data structure, which needs 24 Bytes:

struct TableEntry1
{
    unsigned __int64 lock;
    unsigned char move;
    short score;
    enum { VALID, UBOUND, LBOUND } flag;
    char height;
};

After rearranging the elements it needs 16 Bytes (I found the answer for this
behavior):

struct TableEntry2
{
    unsigned __int64 lock;
    enum { VALID, UBOUND, LBOUND } flag;
    short score;
    char height;
    unsigned char move;
};

My last try was:

struct TableEntry3
{
    unsigned __int64 lock;
    unsigned int move:3;
    int score:12;
    enum { VALID, UBOUND, LBOUND } flag:2;
    int height:7;
};

Which also needs 16 Bytes. Is it possible to change the structure so that it
only uses 12 Bytes (on a 32 bit-architecture)? Why the compiler doesn’t make my last try 12 bytes long?

Thanks!

Edit The property lock is a unique element id to detect hash collisions.

  • 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-19T04:46:25+00:00Added an answer on May 19, 2026 at 4:46 am

    Depending on how you implement locks, it may be possible to reduce the size of your lock field (I’m assuming this is a typical SMP lock SMP machine)

    One option would be to reduce the number of locks. That is, have a seperate, smaller array of locks, and lock an element derived from your array element here. That is, if you’re accessing transposition table element t, use lock t % locktablesize. The lock table doesn’t have to be nearly as big as the transposition table.

    Using this approach, and your TableEntry2 field order, and assuming your lock table is half the size of the transposition table (which is probably bigger than necessary) you get down to 12 bytes without losing performance due to bitshift operations – this performance loss can be quite significant, so it’s always helpful to be able to avoid it.

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

Sidebar

Related Questions

I'm currently debugging my transposition table for a chess variant engine where pieces can
I'm currently adding transposition tables in my chess engine, and I'm having issues with
This matrix transposition function works, but I'm trying to understand its step by step
I'm writing an AI for a card game and after some testing I've discovered
Is there any fast method to make a transposition of a rectangular 2D matrix
I'm writing a musical transposition application (in simple VB Console) and I want the
Shell sort or odd-even transposition? In my tests come Even-odd transposition sort is faster,
In SQL Server 2005, I have a table say tbl_Info. There I have one
I put chunk transposition in quotes because I don't know whether or what the
I need to do a in-place transposition of a large matrix(so the simplest way

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.