473,320 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Calling function in classes

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

unsigned __int64 Subkeys::RotaionalLeftShift()
{
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 RotaionalLeftShift() 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 2244
D_C
293 100+
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
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...
6
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...
2
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...
3
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...
1
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,...
3
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) ...
4
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...
6
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...
12
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...
5
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.