473,569 Members | 3,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling function in classes

51 New Member
So I am working with classes and I have the following Method, which rotate a variable:

unsigned __int64 Subkeys::Rotaio nalLeftShift()
{
unsigned __int64 top_bits = 0;

top_bits = K >> (sizeof K * CHAR_BIT) -desplazar;
K <<= desplazar;

K |= top_bits;
return K;
}


Then I have another function (permute ()) that belongs to the same class Subkeys, and this function needs to call the RotaionalLeftSh ift() function to rotate two different varable and with diferent rotation, So how do I have to initialize the variable K and desplazar to achive rotations of diferent variables.
for example if part of the permute function code is:

for(ix=0; ix<((sizeof C)/(sizeof C[0]))-1; ix++)
{
C[ix+1] = (C[ix], rote[ix]);
D[ix+1] = f( D[ix] );
}

before of ecxecute the instruction "C[ix+1] = (C[ix], rote[ix]);" , I mus initialize the value for K, in this case K = C[ix] and desplazar = rote[ix]; and so on
So how do I have to manage this. Thanks for your help
Aug 17 '06 #1
1 2255
D_C
293 Contributor
You pass parameters. Since you are dealing with arrays, the best way to pass them is with a pointer and a length variable. I am assuming array C and array rote have the same number of entries. You may want to assert that. I also assume they are character arrays.

Then, the first couple lines of code should be
Expand|Select|Wrap|Line Numbers
  1. unsigned __int64 Subkeys::RotationalLeftShift(int* C_ptr, int* rote_ptr, int length)
  2. {
  3.   char K[length] = *C_ptr;       // Is K int or char array, or what?
  4.   char rote[length] = *rote_ptr; // Same goes for rote.
  5.  
  6.   for(ix = 0; ix < length; ix++)
  7.   {
  8.     ...
Aug 17 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
11430
by: scott | last post by:
hi all, hope some one can help me. Ill try and explain what im trying to do as best i can. i have a parent class that has a vertual function, lets call it virtual int A(). That vertual function does somthing that must be done. This meens that when a child class inherits the class and creates its own vertual int A() the parent class must...
6
3299
by: jchao123 | last post by:
Dear All, I have an MDB file (Access 2000/XP) which contains generic routines I use in various apps (eg, API calls, File access classes etc). I have compiled into an MDE file which I reference in VBA from my other Access applications. This works fine and I'm quite happy with it... except for one area; error handling. In most of my...
2
3478
by: Pawan Aggarwal | last post by:
I'm having trouble with calling an exported function in a native DLL compiled with eMbedded Visual C++ in C# application in PocketPC 2002 OS. Problem Description follows: I have one exported function in the DLL: I am making an application for pocket Pc in C# using this DLL Function. whenever I execute this exe in Pocket pc it returns...
3
3921
by: acg | last post by:
If you have a class with a public method, and another class which will want to call this method, is there a way to determine the type of the calling class within the method being called? For I want to gaurantee only certain other classes/object types can call a specific method in given class. Any advice would be appreciated and if there is...
1
2592
by: H.B. | last post by:
Hi, I need to make a function that can display data on my Managed C++ app and be called by an unmanaged C++ DLL. Something like : void Form1::Form1_Load(System::Object * sender, System::EventArgs * e) { MyDLLInit(MyAppDisplayFunction); }
3
1066
by: Ray Cassick \(Home\) | last post by:
I have several classes that has a public interface (nothing really different there :) ). 1) I would like to ensure that some classes can only be instantiated by a specific class type. 2) I would like to restrict some public methods from being called only from another certain class type. I was trying to figure out a way that I...
4
4788
by: Edwin Gomez | last post by:
I'm a C# developer and I'm new to Python. I would like to know if the concept of Asynchronous call-backs exists in Python. Basically what I mean is that I dispatch a thread and when the thread completes it invokes a method from the calling thread. Sort event driven concept with threads. Thanks. Ed Gomez
6
10618
by: Ajit Goel | last post by:
Hi; We have a Javascript function which I have been tasked to move to a CSharp class. This javascript function uses Regular expression extensively. This function has a string input parameter and output parameter. My questions are: a. Can I expose a function in my CSharp code and internally call a javascript function?? Is this a good...
12
2849
by: bgold | last post by:
Hey. I have a base class (SPRITE), and using this base class I have derived a large number of derived classes (PERSON, BULLET, MISSILE, etc.). Now, at a certain point in my program, I have a pair of pointers, where each is a pointer to the base class (each is a SPRITE *). I know that each of these pointers actually points to one of the...
5
4278
by: bizt | last post by:
Hi, Below I have a simple object / function thing (still getting head round these) declaration: function MyObject() { this.alertMe = function() { alert('hello'); }; this.alertMeAgain() {
0
7703
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...
0
7619
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...
0
7930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5514
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...
0
5228
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...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.