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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:47:30+00:00 2026-05-17T21:47:30+00:00

Good afternoon, This may sound like a silly question, but it would be really

  • 0

Good afternoon,

This may sound like a silly question, but it would be really useful if there was a way around this… Is there any way I can get custom bit-depth integers (for example, a 20-bit integer) in C#?

Thank you very much.

  • 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-17T21:47:31+00:00Added an answer on May 17, 2026 at 9:47 pm

    Good question. As most things, the answer will depend on what you need to do with it.

    I did something similar years ago maintaining a school research project. We had a custom integer type, though it was not necessarily defined by bit-depth per se. It was a prime-factor (with remainder) representation. This was very handy for what it was supposed to do, which was multiply and divide very large numbers. It was very poor for addition and subtraction.

    There are also many other “custom” number implementations out there, a very common one is a custom Fixed Point representation (often seen when implementing deterministic physical simulations in games). There are probably some good overflow posts about this subject. These would be a good start for ideas on how to abstract and then implement a custom numeric representation.

    If you are set on variable-bit-depth integer representation, consider wrapping an internal representation. One possibility may be to use an IEnumerable<byte> and extend it byte by byte as its magnitude increases. Write operators that work against a dynamic range. This may not necessarily be the most optimal form of representation or most performant, but it would likely be the easiest.

    Another possible solution may be to do something similar, but with ‘ulong’. Not as space efficient, but we benefit from 64-bit operations.

    Just spitballing 🙂

    Hope this helps!

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

Sidebar

Related Questions

Good afternoon, I'm sorry if this question is too silly, but I don't know
Good afternoon I would just like to know the easiest way for standard Console
Good afternoon all, I have a class which looks like this: public class Grapheme
Good afternoon, I have three entities (that concern this question) Company (ID, etc..) CompanyAddress
Good afternoon all, I dont know why this is proving so difficult but I
Dear Friends good afternoon. My problem may be this is very basic one i.e.
Good afternoon, I would ask some suggestion about the best way to monitor events
Good afternoon I'm hoping this is going to be nice and a simple f**k
Good afternoon, I have a quick 'top level' question regarding the usage of Facebook
Good afternoon to all, I have this scenario: I am using SQL Server 'BulkInsert'

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.