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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:53:30+00:00 2026-05-27T17:53:30+00:00

I compiled a piece of code about hash function and got error: integer constant

  • 0

I compiled a piece of code about hash function and got error: integer constant is too large for ‘long’ type. I did Google it and it said to add the suffix “ULL”, but I did have ULL as suffix. This suffix is supported only by gcc 4.4.1 and I only have gcc 4.1.2 on the machine and I’m not allowed to install a new compiler. Is there any way to change the code so fix the problem?

Thanks,
-Tony

unsigned long long hash(string k){ //FNV hash
   unsigned long long x = 14695981039346656037ULL;
   for (unsigned int y=0;y<k.length();y++){
      x = x ^ (k[y]);
      x = x * 1099511628211;
   }
   return (x);
}
  • 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-27T17:53:30+00:00Added an answer on May 27, 2026 at 5:53 pm

    1099511628211 is also too big for a (32-bit) long; add the ULL suffix there, too.

    AFAIK, GCC 4.x supports long long for all x. Indeed, I’d have said that GCC 3.x supported long long, at least for the more recent values of x.

    I’m having difficulty making your code trigger any warning, using G++ 4.6.1 on MacOS X 10.7.2 in either 32-bit or 64-bit mode. However, I can get the complaint from the LLVM compiler from XCode 4.x (g++ --version output starts with i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)) does complain until I add the second ULL, but only if I compile in 32-bit mode. If that is used in 64-bit mode, it doesn’t complain either.

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

Sidebar

Related Questions

the following piece of C++ code compiled two years ago in a suse 10.1
I have a piece of C++ code (compiled with g++ under a GNU/Linux environment)
I have a piece of templated code that is never run, but is compiled.
Some time ago I wrote a little piece of code to ask about on
I recently wrote a piece of code which did SomeClass someObject; mysqlpp::StoreQueryResult result =
I've been trying to parallelize this piece of code for about two days and
I get this compile error (sorry, unimplemented: mangling overload) for a piece of code
Recently i saw this piece of code. Shouldnt this line be a compile error?
I can't figure out what Re# is complaining about with a piece of code.
This piece of code compiles and runs as expected on GCC 3.x and 4.x:

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.