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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:23:07+00:00 2026-06-10T03:23:07+00:00

Compiling this code using Emscripten: #include <stdio.h> int main() { unsigned long d1 =

  • 0

Compiling this code using Emscripten:

#include <stdio.h>
int main() {
unsigned long d1 = 0x847c9b5d;
unsigned long q =  0x549530e1;
printf("%lu\n", d1*q);
return 0;
}

yields (using -g):

  $d1=-2072208547; //@line 3 "minusmul.c"
  $q=1419063521; //@line 4 "minusmul.c"
  var $2=$d1; //@line 5 "minusmul.c"
  var $3=$q; //@line 5 "minusmul.c"
  var $4=((($2)*($3))|0); //@line 5 "minusmul.c"

Executing this using js (SpiderMonkey I believe?) or node, I get the result 3217488896. Executing the native executable (compiled using GCC), I get 3217489085. How would one emulate the x86 unsigned 32-bit integer multiplication using JavaScript?

  • 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-06-10T03:23:09+00:00Added an answer on June 10, 2026 at 3:23 am

    Emscripten either does not support exact 32-bit multiplication or it is a bug. Since they mention on the homepage that they have software emulation for 64-bit math, I think it’s a bug. I discovered that you can use CHECK_OVERFLOWS and it will discover the overflow. It doesn’t seem to “repair” it though. To make the program finish with CHECK_OVERFLOWS you need to up the count, marked by “XXX” in the generated source.

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

Sidebar

Related Questions

Look t this code plz: #include <iostream> using namespace std; int main() { enum
When compiling this code on VS2008: #include <vector> using namespace std; class Vertex {
I have the following code: #include <stdio.h> int main(void) { int x __attribute__ ((aligned
I compiled this code using visual studio, double callVariadicDoubleFunc(double * doubles, unsigned int numDoubles,double(*TestFunc)(double,...))
Compiling this code with g++ 4.7.0 ( -Wall -Wextra -Werror -Wconversion -std=c++11 ): #include
I get an undefined reference to 'typeof'-error compiling and linking this: #include <stdio.h> #include
Compiling this code using g++ 4.2.1: struct S { }; template<typename T> struct ST
Given this code: #include <cstdio> #include <iostream> #include <string> using std::cin; using std::cout; using
I'm trying to printf/sprintf floats using this code: sprintf(buff, FPS: %d\n%.4f N %.4f E\nAl:
I'm trying to encrypt and decrypt files with C++, using this code: #include <iostream>

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.