comp.lang.ada
 help / color / mirror / Atom feed
* Byte Swapping in Ada
@ 2007-04-26 18:55 markp
  2007-04-26 21:43 ` Robert A Duff
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: markp @ 2007-04-26 18:55 UTC (permalink / raw)


Does Ada provide any built-in byte swapping routines such as ntohl,
htons, etc.?

Thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Byte Swapping in Ada
  2007-04-26 18:55 Byte Swapping in Ada markp
@ 2007-04-26 21:43 ` Robert A Duff
  2007-04-27  4:54 ` Jeffrey R. Carter
  2007-04-27 11:47 ` Stephen Leake
  2 siblings, 0 replies; 4+ messages in thread
From: Robert A Duff @ 2007-04-26 21:43 UTC (permalink / raw)


markp <markwork66@yahoo.com> writes:

> Does Ada provide any built-in byte swapping routines such as ntohl,
> htons, etc.?

No, but the latest version of GNAT has a package called GNAT.Byte_Swapping.
The x86 version is written with machine code inserts.

- Bob



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Byte Swapping in Ada
  2007-04-26 18:55 Byte Swapping in Ada markp
  2007-04-26 21:43 ` Robert A Duff
@ 2007-04-27  4:54 ` Jeffrey R. Carter
  2007-04-27 11:47 ` Stephen Leake
  2 siblings, 0 replies; 4+ messages in thread
From: Jeffrey R. Carter @ 2007-04-27  4:54 UTC (permalink / raw)


markp wrote:
> Does Ada provide any built-in byte swapping routines such as ntohl,
> htons, etc.?

No. It's a simple operation. You should be able to easily write a 
generic that would swap the bytes in anything, if you really need to do 
this a lot.

-- 
Jeff Carter
"I fart in your general direction."
Monty Python & the Holy Grail
05



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Byte Swapping in Ada
  2007-04-26 18:55 Byte Swapping in Ada markp
  2007-04-26 21:43 ` Robert A Duff
  2007-04-27  4:54 ` Jeffrey R. Carter
@ 2007-04-27 11:47 ` Stephen Leake
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Leake @ 2007-04-27 11:47 UTC (permalink / raw)


markp <markwork66@yahoo.com> writes:

> Does Ada provide any built-in byte swapping routines such as ntohl,
> htons, etc.?

Not in a standard library.

See SAL.Network_Order.*, at http://stephe-leake.org/ada/sal.html

I used to have the SAL source available for web browsing, but I ran
out of web space; I'm working on it :).

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-27 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-26 18:55 Byte Swapping in Ada markp
2007-04-26 21:43 ` Robert A Duff
2007-04-27  4:54 ` Jeffrey R. Carter
2007-04-27 11:47 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox