I have an embedded 16 bit CPU. On this machine ints are 16 bit wide and it supports longs that are 32 bits wide. I need to do some multiplications that will need to be stored in 64 bits (e.g. multiply a 32 bit number by a 16 bit number). How can I do that with the given constraints? I do not have a math library to do this.
How to do 64 bit multiply on 16 bit machine?
3.5k views Asked by SeanLabs At
2
There are 2 answers
0
ldav1s
On
You might want to check out Hacker's Delight (it's a book and a website). They have C implementations of Knuth's signed multiword multiplication and unsigned multiword multiplication from The Art of Computer Programming Vol.2.
Related Questions in 64-BIT
- GDI - Why the printing StartPage() function works in 32 bit but raises an exception in 64 bit?
- GNU AS ASM to bytecode dump
- How do I use .lib to compile and link in c++ builder 11.3 windows 64bits platform?
- Windows 64-bit: Do overlapped MMF windows mean more RAM consumption (doubling the RAM where the file views overlap)?
- Invoke jar from C++ using JNI
- SQLBindCol for long integer value on 64Bit platform?
- Assembly segmentation fault in example code
- PowerShell switch block and values coded in 64 bits
- How can I get a 32-bit output with Python on a 64-bit system?
- Recompiled APK throws error "This release is not compliant with the Google Play 64-bit requirement"
- Porting code that wraps ODBC API to 64 bit questions
- ilink64 Error Fatal: Unable to open file 'VCL.VIRTUALIMAGELIST.O'
- Open and write file in nasm for Windows 64bit
- C display tansparent text on any background
- Problem with quicksort function on arrays of 64 bits integers in C
Related Questions in 16-BIT
- I search a unit to solve the turbo pascal 255 string limit
- VGA output not showing if DI > 32767
- Problem using Open Watcom v2 for generating a bare metal application for 80186 CPU
- Second sector kernel not printing strings (16-bit ASM)
- How can I get the index of an array in DOS Assembly x86 (16-bit)?
- Turbo Assembler 16 BIT Encryption Binary File
- C# EmguCV PictureBox - How to display unsigned 16 bit grayscale images?
- OS on a real-machine
- Assembly 16bit real mode - CMPS return always 0
- convert an array of ascii numbers in binary numbers assembly x86 16-bit
- Why my print function doesn't print my string?
- How to reverse the byte shifts after I have extracted a value in C?
- In Java: How to make a DMX moving generator that uses 16Bit
- webworker and module import from fast-png does not work
- Reading a signed bits in Lua
Related Questions in MULTIPLICATION
- RiscV checking if overflow has occurred during multiplication
- Replace last value in each row of a 2d array with the product of all values in the row excluding the last
- How to access specific elements (by index) in Keras?
- Understanding the Output of Vector and Matrix Multiplication in R
- How many additions operation can be performed instead of single multiplication in FPGA?
- Multiply two columns of different dataframes in Python
- Multiplications a*b vs a*0: execution time
- How to combine elements in Karatsuba multiplication
- Multiplying 2 values gives the original value but dividing the same values gives the right answer
- vectorize numpy array multiplication
- Multiplying Two Tables in R
- Intel xmm registers do not load and multiply correctly
- How does the Radix-2 Montgomery multiplication algorithm R2MM work on bit level?
- How to multiple two values of type driver.Value
- Table multiplication in Angular using ngFor
Related Questions in INTEGER-ARITHMETIC
- How to divide a nonnegative variable integer by a constant fixed-point rational ≥1 without overflow (at all, if possible)?
- GMP Library: unsigned/signed arithmetics
- Emulate Javascript's 32bit signed integer arithmetic to C (or Perl) - some discrepancies
- Safely check if signed multiplication would overflow in C++17
- Logarithm of a positive number result in minus infinity python
- Matching arithmetic expressions in SWI-Prolog?
- Can one emulate bitwise arithmetic "and" or "or" using only non-bitwise operations?
- What is the minimum odd number representable in a 32-bit float, written in both decimal and binary?
- rust relative array indexing
- What does mean ARR in the half place in C?
- Why is X staying = 1?
- Python Overflow Warning in Scalar Add
- Does (++i)+(++i) have the defined behavior in Java
- Why did Matlab choose saturation arithmetic for integers?
- Unexpected behaviour on underflow of unsigned char
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
A suggestion in C. Note that this code probably will be easier to implement with inline assembler as carry detection in C doesn't seem that easy