Skip to Content.
Sympa Menu

freetds - Re: convert_int4 on Solaris(Sparc)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Kevin <kevin AT nol.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: convert_int4 on Solaris(Sparc)
  • Date: Fri, 29 Jan 1999 22:59:07 +0000


> Sparcs need to be word aligned when accessing words. What is the value
> of src? Is on a 4 byte
> address? What I mean is (src % 4) needs to be 0.
thanks to my collegues, I just figured this one out as well :)
With a datetime comming in as a 9 byte value, acessing any word
aligned
value (like the 4 byte int4) will screw things up royaly. I found that
the following seems to do the trick, but one might concider this a
kludge, but it saves a call to memcpy...
char *a, *b;
int x,i;

*a = (char*)src;
*b = (char*)&x;

for(i=0; i < 4; i++) { (a++) = (b++); }

At this point x is your word aligned int value.

This does raise another quick question for me, however...anyone know
what the last byte in the datetime value is for, or in other words, why
is a datetime a 9 byte value, not 8?

-- Kevin
-----------------------------------------------------------------------
Kevin M. Lyons Phone: (402)-471-7870 Email: kevin AT nol.org
No matter what happens, somebody will find a way to take it way too
seriously - Dave Barry
-----------------------------------------------------------------------




Archive powered by MHonArc 2.6.24.

Top of Page