| The Android Open Source Project | cbb1011 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| Elliott Hughes | b6e7de2 | 2019-09-18 08:02:10 -0700 | [diff] [blame] | 17 | #pragma once |
| The Android Open Source Project | cbb1011 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 18 | |
| Elliott Hughes | b6e7de2 | 2019-09-18 08:02:10 -0700 | [diff] [blame] | 19 | /* |
| 20 | * If you're looking for a portable <endian.h> that's available on Android, |
| 21 | * Linux, macOS, and Windows, see <android-base/endian.h> instead. |
| 22 | * |
| 23 | * Nothing in this file is useful because all supported Android ABIs are |
| 24 | * little-endian and all our code that runs on the host assumes that the host is |
| 25 | * also little-endian. What pretense at big-endian support exists is completely |
| 26 | * untested and unlikely to actually work. |
| 27 | */ |
| The Android Open Source Project | cbb1011 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | |
| 29 | #include <stdint.h> |
| 30 | #include <sys/types.h> |
| Elliott Hughes | adbf442 | 2015-07-29 17:45:24 -0700 | [diff] [blame] | 31 | #if defined(_WIN32) |
| The Android Open Source Project | cbb1011 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | #include <winsock2.h> |
| 33 | #else |
| 34 | #include <netinet/in.h> |
| 35 | #endif |
| 36 | |
| Elliott Hughes | b6e7de2 | 2019-09-18 08:02:10 -0700 | [diff] [blame] | 37 | /* TODO: move this cruft to frameworks/. */ |
| The Android Open Source Project | cbb1011 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 38 | |
| Elliott Hughes | b6e7de2 | 2019-09-18 08:02:10 -0700 | [diff] [blame] | 39 | #define dtohl(x) (x) |
| 40 | #define dtohs(x) (x) |
| 41 | #define htodl(x) (x) |
| 42 | #define htods(x) (x) |
| Joe Onorato | 62a381b | 2009-05-15 09:07:06 -0400 | [diff] [blame] | 43 | |
| Joe Onorato | 62a381b | 2009-05-15 09:07:06 -0400 | [diff] [blame] | 44 | #define fromlel(x) (x) |
| Joe Onorato | 62a381b | 2009-05-15 09:07:06 -0400 | [diff] [blame] | 45 | #define tolel(x) (x) |