15,912,400 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Charles Keepax (Top 4 by date)
Charles Keepax
7-Oct-10 4:27am
View
Your variables r0-r4 are effectively arrays of 4 16-bit numbers; a 16-bit number can only be 0 to 65536 or -32768 to 32767 since you are using signed variables. 6,000,000 is too large to store in a 16-bit number, thus you will need to extract it into a 32-bit number. The following code (assuming int is 32-bit on your system) does this with the first number however it is almost certainly a poor way to use the MMX extensions, but the best way to use them would depend rather heavily on context.
unsigned short B[4]={2000,2000,2000,2000};
unsigned short C[4]={3000,3000,3000,3000};
unsigned short D[4]={0,0,0,0};
unsigned short E[4]={0,0,0,0};
__m64*b =(__m64*)B;
__m64*c =(__m64*)C;
__m64*d =(__m64*)D;
__m64*e =(__m64*)E;
*d =_mm_mullo_pi16(*b,*c);
*e =_mm_mulhi_pi16(*b,*c);
int temp = E[0];
temp = (temp<<16) | D[0];
Charles Keepax
5-Oct-10 9:19am
View
That would be about right, you need to stick them together to get your answer. So 36224 in hex is 0x8D80 and 91 in hex is 0x5B. Shift the hi result by 16 bits then AND them together and you will get 0x5B8D80, which is hex for 6000000.
Charles Keepax
29-May-10 18:47pm
View
Distance from the camera would also play a fairly large factor in that as well.
Charles Keepax
27-May-10 2:49am
View
Glad that helps, should be the only problem and it should work perfectly after you fix it.