473,785 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fast 64-bit dividend minu remainder calculation

hi,

is there a way to fast calculate x-x%y (greatest multiplication of y
before x), where x and y are 64-bit integers on a 32-bit machine??
Maybe MMX registers would be useful?? I am writing this with gcc and
gas. Any help would be appreciated and thanks in advance.

Best regards,

Przemek

May 1 '07 #1
2 1842
<ps****@gmail.c omwrote in message
news:11******** *************@n 59g2000hsh.goog legroups.com...
is there a way to fast calculate x-x%y (greatest multiplication of y
before x), where x and y are 64-bit integers on a 32-bit machine??
Maybe MMX registers would be useful?? I am writing this with gcc and
gas. Any help would be appreciated and thanks in advance.
If you have long long support, I think (x / y) * y gives you what you want.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
May 1 '07 #2
ps****@gmail.co m wrote:
>
is there a way to fast calculate x-x%y (greatest multiplication of y
before x), where x and y are 64-bit integers on a 32-bit machine??
Maybe MMX registers would be useful?? I am writing this with gcc and
gas. Any help would be appreciated and thanks in advance.
Easy, if you have a C99 compiler and the long long type. Otherwise
look at your compiler documentation.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

May 1 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2056
by: Hugo | last post by:
I have a dual boot machine, runs Win XP pro and Win XP Pro 64, XP boots from C and XP 64 boots from D. They both have VS 2005 Beta 2 installed. I have a webapp developed in Win XP (32) which has gone well and runs fine in XP. I Now want to get this same app running under IIS on XP 64.
0
1030
by: Kathryn Doss | last post by:
<html> <body> <div style="width:100%;height:400px;"> <table style="position:relative;z-index:0;" width="100%" height="100%" border="0" cellpadding="20" cellspacing="0"> <tr> <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="64"><table width="64" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td>&nbsp;</td>
3
2498
by: garth_rockett | last post by:
We need to process a very large amount of delimited variable length ASCII data in files as large as 3-4 gigs. We need a high performance parser for this and as always, we have no money to buy one. We are ok with building one as long as that can be done quick enough and I was wondering if Boost has a panacea for us. Can anyone help with their ideas / experience. I am also very open to any suggestions outside Boost. Any outline on how to...
4
3620
by: Alexis Gallagher | last post by:
(I tried to post this yesterday but I think my ISP ate it. Apologies if this is a double-post.) Is it possible to do very fast string processing in python? My bioinformatics application needs to scan very large ASCII files (80GB+), compare adjacent lines, and conditionally do some further processing. I believe the disk i/o is the main bottleneck so for now that's what I'm optimizing. What I have now is roughly as follows (on python...
10
10717
by: krunalb | last post by:
Hi, I am trying to shift unsigned long long value by 64 bits and this is what i get #include <stdio.h> int main() { unsigned short shiftby= 64;
2
4525
by: Gernot Frisch | last post by:
Hi, I have some code that scales from an image buffer to the screen buffer (line by line). Assume: int Width; // Width of image (e.g. 32) int zWidth; // Width of screen output (e.g. 192) // Now, I perform interpolation of:
3
3628
by: Gernot Frisch | last post by:
Hi, I have this code that blends 2 pixels, but it's not really fast. Can someone help me speeding it up? #define GETR(a) (unsigned char)(((((a)>>11)&31)*255)/31) #define GETG(a) (unsigned char)(((((a)>5)&63)*255)/63) #define GETB(a) (unsigned char)(((((a) )&31)*255)/31)
95
5428
by: hstagni | last post by:
Where can I find a library to created text-based windows applications? Im looking for a library that can make windows and buttons inside console.. Many old apps were make like this, i guess ____________________________________ | | | ------------------ | | | BUTTON | | | ...
0
8012
by: Vinod Sadanandan | last post by:
Fast-Start Failover An Overview In Dataguard Environment ============================================================================= This article describes the automatic fast start failover configuration and the conditions for trigerring a fast start failover in dataguard environment . In Faststart failover dataguard configuration if the primary database becomes unavailable, the...
1
1042
by: jihad4u | last post by:
assuming i have data for students names,credit hours, totalpoint or qualitypoints. i have trouble with both counting that is total number of students who fall under each category. printing students. To do: Count and print the number of students in each classification. Use the following classification scheme: 0-31 credits Freshman 32-63 credits Sophomore 64-95 credits Junior over 96 credits Senior
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.