Skip to content

Commit 11f1aaf

Browse files
theamirocohenYossi Levy
authored andcommitted
Fix pithy library
1 parent 5f7a640 commit 11f1aaf

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

TESTS/mbed_hal/trng/pithy/pithy.c

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@
5353
// The maximum size that can be compressed while still allowing for the worst case compression expansion.
5454
#define PITHY_UNCOMPRESSED_MAX_LENGTH 0xdb6db6bfu // 0xdb6db6bf == 3681400511, or 3510.857 Mbytes.
5555

56-
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__arm__)
57-
#define PITHY_UNALIGNED_LOADS_AND_STORES
58-
#endif
59-
6056
typedef const char *pithy_hashOffset_t;
6157

6258
enum {
@@ -100,7 +96,6 @@ enum {
10096
} while(0)
10197
#endif
10298

103-
10499
PITHY_STATIC_INLINE const char *pithy_Parse32WithLimit(const char *p, const char *l, size_t *OUTPUT);
105100
PITHY_STATIC_INLINE char *pithy_Encode32(char *ptr, uint32_t v);
106101

@@ -112,56 +107,15 @@ PITHY_STATIC_INLINE char *pithy_EmitCopyGreaterThan63(char *op, size_t off
112107
PITHY_STATIC_INLINE char *pithy_EmitCopyLessThan63(char *op, size_t offset, size_t len);
113108
PITHY_STATIC_INLINE char *pithy_EmitCopy(char *op, size_t offset, size_t len);
114109

115-
116-
#ifdef PITHY_UNALIGNED_LOADS_AND_STORES
117-
118-
#define pithy_Load16(_p) (*((uint16_t *)(_p)))
119-
#define pithy_Load32(_p) (*((uint32_t *)(_p)))
120-
#define pithy_Store16(_p, _val) (*((uint16_t *)(_p)) = (_val))
121-
#define pithy_Store32(_p, _val) (*((uint32_t *)(_p)) = (_val))
122-
123-
#if defined(__arm__)
124-
125-
#if defined(__ARM_NEON__)
126-
#define pithy_Load64(_p) ((uint64_t)vld1_u64(_p))
127-
#define pithy_Store64(_p, _val) vst1_u64(_p, (uint64x1_t)_val)
128-
#else
129-
#define PITHY_32BIT_MOVE64
130-
PITHY_STATIC_INLINE uint64_t pithy_Load64(const void *p) { uint64_t t; memcpy(&t, p, sizeof(t)); return (t); }
131-
#endif
132-
133-
#else // not __arm__
134-
#define pithy_Load64(_p) (*((uint64_t *)(_p)))
135-
#define pithy_Store64(_p, _val) (*((uint64_t *)(_p)) = (_val))
136-
#endif // __arm__
137-
138-
#else
139-
140110
PITHY_STATIC_INLINE uint16_t pithy_Load16(const void *p) { uint16_t t; memcpy(&t, p, sizeof(t)); return (t); }
141111
PITHY_STATIC_INLINE uint32_t pithy_Load32(const void *p) { uint32_t t; memcpy(&t, p, sizeof(t)); return (t); }
142112
PITHY_STATIC_INLINE uint64_t pithy_Load64(const void *p) { uint64_t t; memcpy(&t, p, sizeof(t)); return (t); }
143113
PITHY_STATIC_INLINE void pithy_Store16(void *p, uint16_t v) { memcpy(p, &v, sizeof(v)); }
144114
PITHY_STATIC_INLINE void pithy_Store32(void *p, uint32_t v) { memcpy(p, &v, sizeof(v)); }
145115
PITHY_STATIC_INLINE void pithy_Store64(void *p, uint64_t v) { memcpy(p, &v, sizeof(v)); }
146116

147-
#endif
148-
149-
150-
#ifdef PITHY_32BIT_MOVE64
151-
#define pithy_Move64(dst,src) pithy_Store32(dst, pithy_Load32(src)); \
152-
pithy_Store32(dst + 4ul, pithy_Load32(src + 4ul));
153-
#else
154117
#define pithy_Move64(dst,src) pithy_Store64(dst, pithy_Load64(src));
155-
#endif
156-
157-
158-
#if defined(__arm__) && defined(__ARM_NEON__) && defined(PITHY_UNALIGNED_LOADS_AND_STORES)
159-
#define pithy_Move128(_dst,_src) ({ \
160-
asm ("vld1.64 {d0-d1}, [%[src]]\n\tvst1.64 {d0-d1}, [%[dst]]" : : \
161-
[src]"r"(_src), [dst]"r"(_dst) : "d0", "d1", "memory"); })
162-
#else
163118
#define pithy_Move128(dst,src) pithy_Move64(dst, src); pithy_Move64(dst + 8ul, src + 8ul);
164-
#endif
165119

166120
#ifdef __BIG_ENDIAN__
167121

0 commit comments

Comments
 (0)