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 17 #pragma once 18 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 */ 28 29 #include <stdint.h> 30 #include <sys/types.h> 31 #if defined(_WIN32) 32 #include <winsock2.h> 33 #else 34 #include <netinet/in.h> 35 #endif 36 37 /* TODO: move this cruft to frameworks/. */ 38 39 #define dtohl(x) (x) 40 #define dtohs(x) (x) 41 #define htodl(x) (x) 42 #define htods(x) (x) 43 44 #define fromlel(x) (x) 45 #define tolel(x) (x) 46