[RS6000] cost SLOW_UNALIGNED_ACCESS
[official-gcc.git] / gcc / ada / g-sothco.adb
blob4e8fbdee8c30d567d46a82b7326c38890e4ee2fd
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- G N A T . S O C K E T S . T H I N _ C O M M O N --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2008-2010, AdaCore --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 package body GNAT.Sockets.Thin_Common is
34 -----------------
35 -- Set_Address --
36 -----------------
38 procedure Set_Address
39 (Sin : Sockaddr_In_Access;
40 Address : In_Addr)
42 begin
43 Sin.Sin_Addr := Address;
44 end Set_Address;
46 ----------------
47 -- Set_Family --
48 ----------------
50 procedure Set_Family
51 (Length_And_Family : out Sockaddr_Length_And_Family;
52 Family : Family_Type)
54 C_Family : C.int renames Families (Family);
55 Has_Sockaddr_Len : constant Boolean := SOSC.Has_Sockaddr_Len /= 0;
56 begin
57 if Has_Sockaddr_Len then
58 Length_And_Family.Length := Lengths (Family);
59 Length_And_Family.Char_Family := C.unsigned_char (C_Family);
60 else
61 Length_And_Family.Short_Family := C.unsigned_short (C_Family);
62 end if;
63 end Set_Family;
65 --------------
66 -- Set_Port --
67 --------------
69 procedure Set_Port
70 (Sin : Sockaddr_In_Access;
71 Port : C.unsigned_short)
73 begin
74 Sin.Sin_Port := Port;
75 end Set_Port;
77 end GNAT.Sockets.Thin_Common;