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 best solutions below
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
- (x64 Nasm) Writeline function on Linux
- How to return a 16 bit value as 64 bit?
- iOS: app doesn't pass the upload for the architecture
- Can't open mkl_intel_s_dll.lib in 64bit Visual Studio environment
- Intel x64 instructions CMPSB/CMPSW/CMPSD/CMPSQ
- Zlib decompression method warning using ios 64bit Architecture
- Assembly x64: Using MULPD instruction with integer
- VirtualBox: VERR_VMX_MSR_VMXON_DISABLED
- 64bit bitmask and javascript
- Delphi xe2 Error compiling ASM code with x64 compiler. Unsupported language feature: 'ASM'
- Cordova 3.8.0 Build Causes Errors in Iphone Apps locking up at Splash Screen
- DirectX libs in x64 program
- Is there any reason to still use int as opposed to long on a 64 bit machine?
- In 64bit R, what should my memory.limit() be set to?
- NASM issue on OSX 64-bit
Related Questions in 16-BIT
- What happens if I sum negative values to a 16bit register constantly
- assembly - How to boot kernel that is appended end of kernel?
- How to pass/retrieve DOS command-line parameters in a 16-bit assembly program?
- Indexed float array in NASM x86 16-bit
- 16 bit Assembly not printing character
- Create a 16bit application?
- Delphi - Rumor about run 16-bit assembly writing a sys file on Windows 10
- How do I copy files from a CD-ROM in [Files] using Flags: external?
- what is meant by 32-bit application?
- Timed task list
- can the license information stored in Dongle be taken out of it and stored on a file or something?
- How to do 64 bit multiply on 16 bit machine?
- Can I convert a 16-bit .exe program to a 64-bit .exe?
- Saving as 16-bit .raww ("Raw image format (Word)") in ImageJ or MATLAB to import to DaVis
- Is the Z80 'Game Boy' CPU 8 or 16 bits?
Related Questions in MULTIPLICATION
- VB.net: How to make original variable value fulfill 2 statements?
- Conditional subtraction Part 2
- Conditional subtraction
- VB.net: How to add different multipliers together?
- Multiply polynomials
- Perform integer division using multiplication
- multiplying rows in dataframe based on row in another datarame pandas
- Lots of cache miss, Sparse matrix multiplication
- Booth Multiplication Algorithm
- Issues With length() And Multiples Of 3
- mysql calculate multiplication with group by
- multiplication of very large with small values
- Need help in writing this multiplication code
- function to get the power of a number
- Multiplying 2 decimal values resulting wrong number
Related Questions in INTEGER-ARITHMETIC
- 32 bit signed integer division gives 0x7fffffff as quotient on PowerPC
- Exact sum of a long array
- Arithmetic on a struct representing a large integer
- C++ Number theory: Fastest way to compute max(y = a_i * x+ b_i) <= k
- Calculating the modulo of two intervals
- Panicked at 'attempt to subtract with overflow' when cycling backwards though a list
- Checksum without logic/bitwise operations
- perl - int() decrementing an integer
- Large Integer Arithmetic - how to implement modulo?
- Nicer arithmetics on primitive types in Rust
- Safely add, subtract divide unsigned chars
- how to change Map<String,String> to Map<String,Ratio> with ratio being x/y
- regex to get numerator and denominator for a ratio x/y
- When to pick 'Natural' over 'Integer' in Haskell?
- How to do arithmetic modulo another number, without overflow?
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)
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?
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