• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Using vBigNum in a C tool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using vBigNum in a C tool


  • Subject: Using vBigNum in a C tool
  • From: Graham J Lee <email@hidden>
  • Date: Mon, 20 Jun 2005 17:07:26 +0100

Hi,

I originally asked this in scitech@ - as that's not explicitly a developer list I thought it would be better asked over here.
I'm porting a programming lab for physics undergrads from Solaris to OS X. One of the practicals is on cryptography, and I thought it would be instructive [at least to me ;-)] to use vBigNum to perform the large number calculations - eventually I want to use vDSP in some of the other practicals, but I'm having trouble using the framework at all :-(. I'm currently working on XCode 1.5 on 10.3.9, moving to 10.4.x with XCode 2.1 hopefully imminently. I've added Accelerate.framework to a 'Standard C Tool' project, and have included <Accelerate/Accelerate.h> in the main.c file. In fact, main.c looks like this [the badness or otherwise of the code can be determined after the compilingness or otherwise has been fixed]:


#include <stdio.h>
#include <string.h>
#include <Accelerate/Accelerate.h>

void vU256HalfPow(const vU256 *base, const vU256 *exponent, const vU256 *result);

int main (int argc, const char * argv[]) {
    // insert code here...
    printf("Hello, World!\n");
    return 0;
}

void vU256HalfPow(const vU256 *base, const vU256 *exponent, vU256 *result)
{
// calculate result=base^exponent using Altivec big numbers
int bits=256,i;
vU256 *t1,*t2,*t3,*t4;
memcpy((void *)t1,(void *)base,sizeof(vU256));
memcpy((void *)t3,(void *)exponent,sizeof(vU256));

result->s.MSW=0;
result->s.d2=0;
result->s.d3=0;
result->s.d4=0;
result->s.d5=0;
result->s.d6=0;
result->s.d7=0;
result->s.LSW=1;

for(i=0;i<bits;)
{
memcpy((void *)t2,(void *)t1,sizeof(vU256));
if((t3->s.LSW) && 1) vU256HalfMultiply(t1,t2,result);
memcpy((void *)t4,(void *)t2,sizeof(vU256));
vU256HalfMultiply(t4,t2,t1);
vLRU256Shift(exponent,(unsigned long)(++i),t3);
}
}


but building the project doesn't work. I've included the output from xcodebuild, but it just looks like the header isn't being picked up - possibly not the dependency on Accelerate at all. I've tried 'cc -o main -framework Accelerate main.c' in the project directory and get the same errors. Is it that the header isn't being included, and how can I change that?

Thanks,

Graham.

leeg@leegion:~/devel/course/bignum_pow>xcodebuild=== BUILDING NATIVE TARGET bignum_pow WITHOUT USING ANY BUILD STYLE ===CompileC build/bignum_pow.build/bignum_pow.build/Objects-normal/ppc/main.o main.c normal ppc c com.apple.compilers.gcc.3_3 cd /var/automount/Users/staff/leeg/devel/course/bignum_pow /usr/bin/gcc-3.3 -x c -arch ppc -pipe -Wno-trigraphs -fasm-blocks -fpascal-strings -Os -mtune=G4 -fmessage-length=0 -F/var/automount/Users/staff/leeg/devel/course/bignum_pow/build -I/var/automount/Users/staff/leeg/devel/course/bignum_pow/build/include -I/var/automount/Users/staff/leeg/devel/course/bignum_pow/build/ bignum_pow.build/bignum_pow.build/DerivedSources -Wp,-header-mapfile,/var/automount/Users/staff/leeg/devel/course/ bignum_pow/build/bignum_pow.build/bignum_pow.build/bignum_pow.hmap -c /var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c -o /var/automount/Users/staff/leeg/devel/course/bignum_pow/build/ bignum_pow.build/bignum_pow.build/Objects-normal/ppc/main.o
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:5: error: parse error before '*' token
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:13: error: parse error before '*' token
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c: In function `vU256HalfPow':
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:17: error: `vU256' undeclared (first use in this function)
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:17: error: (Each undeclared identifier is reported only once
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:17: error: for each function it appears in.)
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:17: error: `t1' undeclared (first use in this function)
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:17: error: `t2' undeclared (first use in this function)
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:17: error: `t3' undeclared (first use in this function)
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:17: error: `t4' undeclared (first use in this function)
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:18: error: `base' undeclared (first use in this function)
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:19: error: `exponent' undeclared (first use in this function)
/var/automount/Users/staff/leeg/devel/course/bignum_pow/main.c:21: error: `result' undeclared (first use in this function)
** BUILD FAILED **


--
Graham Lee                       GPG Key ID: 01D5B9D8
UNIX Systems Manager,
Oxford Physics Practical Course
http://nextstep.sdf-eu.org               01865 273450

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Using vBigNum in a C tool
      • From: Mark Bessey <email@hidden>
  • Prev by Date: Re: XCode 1.5 target editing error
  • Next by Date: Re: Subversion Included?
  • Previous by thread: Re: compiling resources using xcode 1.5
  • Next by thread: Re: Using vBigNum in a C tool
  • Index(es):
    • Date
    • Thread