Repository: incubator-mynewt-larva Updated Branches: refs/heads/master 2ffa9b4f0 -> 8df6025e8
Move endian.h from libs/util to libs/os. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/8df6025e Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/8df6025e Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/8df6025e Branch: refs/heads/master Commit: 8df6025e868f0adf329de25215a21b53db0cdd21 Parents: 2ffa9b4 Author: Christopher Collins <ccollins47...@gmail.com> Authored: Tue Dec 8 14:29:04 2015 -0800 Committer: Christopher Collins <ccollins47...@gmail.com> Committed: Tue Dec 8 14:29:04 2015 -0800 ---------------------------------------------------------------------- libs/os/include/os/endian.h | 89 ++++++++++++++++++++++++++++++++++++ libs/shell/src/shell.c | 2 +- libs/util/include/util/endian.h | 89 ------------------------------------ 3 files changed, 90 insertions(+), 90 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/8df6025e/libs/os/include/os/endian.h ---------------------------------------------------------------------- diff --git a/libs/os/include/os/endian.h b/libs/os/include/os/endian.h new file mode 100644 index 0000000..c8c838a --- /dev/null +++ b/libs/os/include/os/endian.h @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2015 Runtime Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef H_ENDIAN_ +#define H_ENDIAN_ + +#include <inttypes.h> + +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + +#ifndef ntohll +#define ntohll(x) ((uint64_t)(x)) +#endif + +#ifndef htonll +#define htonll(x) ((uint64_t)(x)) +#endif + +#ifndef ntohl +#define ntohl(x) ((uint32_t)(x)) +#endif + +#ifndef htonl +#define htonl(x) ((uint32_t)(x)) +#endif + +#ifndef ntohs +#define ntohs(x) ((uint16_t)(x)) +#endif + +#ifndef htons +#define htons(x) ((uint16_t)(x)) +#endif + +#else + +#ifndef ntohll +#define ntohll(x) ((uint64_t) \ + ((((x) & 0xff00000000000000ull) >> 56) | \ + (((x) & 0x00ff000000000000ull) >> 40) | \ + (((x) & 0x0000ff0000000000ull) >> 24) | \ + (((x) & 0x000000ff00000000ull) >> 8) | \ + (((x) & 0x00000000ff000000ull) << 8) | \ + (((x) & 0x0000000000ff0000ull) << 24) | \ + (((x) & 0x000000000000ff00ull) << 40) | \ + (((x) & 0x00000000000000ffull) << 56))) +#endif + +#ifndef htonll +#define htonll ntohll +#endif + +#ifndef ntohl +#define ntohl(x) ((uint32_t) \ + ((((x) & 0xff000000) >> 24) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x000000ff) << 24))) +#endif + +#ifndef htonl +#define htonl ntohl +#endif + +#ifndef htons +#define htons(x) ((uint16_t) \ + ((((x) & 0xff00) >> 8) | \ + (((x) & 0x00ff) << 8))) +#endif + +#ifndef ntohs +#define ntohs htons +#endif + +#endif +#endif http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/8df6025e/libs/shell/src/shell.c ---------------------------------------------------------------------- diff --git a/libs/shell/src/shell.c b/libs/shell/src/shell.c index 6a51e4e..c0d57de 100644 --- a/libs/shell/src/shell.c +++ b/libs/shell/src/shell.c @@ -19,8 +19,8 @@ #include <console/console.h> #include <shell/shell.h> +#include <os/endian.h> #include <util/base64.h> -#include <util/endian.h> #include <stdio.h> #include <string.h> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/8df6025e/libs/util/include/util/endian.h ---------------------------------------------------------------------- diff --git a/libs/util/include/util/endian.h b/libs/util/include/util/endian.h deleted file mode 100644 index c8c838a..0000000 --- a/libs/util/include/util/endian.h +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) 2015 Runtime Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef H_ENDIAN_ -#define H_ENDIAN_ - -#include <inttypes.h> - -#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - -#ifndef ntohll -#define ntohll(x) ((uint64_t)(x)) -#endif - -#ifndef htonll -#define htonll(x) ((uint64_t)(x)) -#endif - -#ifndef ntohl -#define ntohl(x) ((uint32_t)(x)) -#endif - -#ifndef htonl -#define htonl(x) ((uint32_t)(x)) -#endif - -#ifndef ntohs -#define ntohs(x) ((uint16_t)(x)) -#endif - -#ifndef htons -#define htons(x) ((uint16_t)(x)) -#endif - -#else - -#ifndef ntohll -#define ntohll(x) ((uint64_t) \ - ((((x) & 0xff00000000000000ull) >> 56) | \ - (((x) & 0x00ff000000000000ull) >> 40) | \ - (((x) & 0x0000ff0000000000ull) >> 24) | \ - (((x) & 0x000000ff00000000ull) >> 8) | \ - (((x) & 0x00000000ff000000ull) << 8) | \ - (((x) & 0x0000000000ff0000ull) << 24) | \ - (((x) & 0x000000000000ff00ull) << 40) | \ - (((x) & 0x00000000000000ffull) << 56))) -#endif - -#ifndef htonll -#define htonll ntohll -#endif - -#ifndef ntohl -#define ntohl(x) ((uint32_t) \ - ((((x) & 0xff000000) >> 24) | \ - (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | \ - (((x) & 0x000000ff) << 24))) -#endif - -#ifndef htonl -#define htonl ntohl -#endif - -#ifndef htons -#define htons(x) ((uint16_t) \ - ((((x) & 0xff00) >> 8) | \ - (((x) & 0x00ff) << 8))) -#endif - -#ifndef ntohs -#define ntohs htons -#endif - -#endif -#endif