Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
2645bc1b
Commit
2645bc1b
authored
Dec 18, 2021
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sdb-lib: add move htonll and ntohll from libsdbfs.h to libsdbfs-user.h
Signed-off-by:
Adam Wujek
<
dev_public@wujek.eu
>
parent
487309ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
+19
-16
libsdbfs-freestanding.h
sdb-lib/libsdbfs-freestanding.h
+2
-0
libsdbfs-user.h
sdb-lib/libsdbfs-user.h
+17
-0
libsdbfs.h
sdb-lib/libsdbfs.h
+0
-16
No files found.
sdb-lib/libsdbfs-freestanding.h
View file @
2645bc1b
...
...
@@ -14,6 +14,8 @@
# define htons(x) (x)
# define ntohl(x) (x)
# define htonl(x) (x)
# define ntohll(x) (x)
# define htonll(x) (x)
#elif CPU_ARCH == RISCV
/* FIXME: fix for riscv */
#warning FIXME: fix sdbfs for riscv
...
...
sdb-lib/libsdbfs-user.h
View file @
2645bc1b
...
...
@@ -12,4 +12,21 @@
#define sdb_print(format, ...) fprintf(stderr, format, __VA_ARGS__)
/* This is needed to convert endianness. Hoping it is not defined elsewhere */
static
inline
uint64_t
htonll
(
uint64_t
ll
)
{
uint64_t
res
;
if
(
htonl
(
1
)
==
1
)
return
ll
;
res
=
htonl
(
ll
>>
32
);
res
|=
(
uint64_t
)(
htonl
((
uint32_t
)
ll
))
<<
32
;
return
res
;
}
static
inline
uint64_t
ntohll
(
uint64_t
ll
)
{
return
htonll
(
ll
);
}
#endif
/* __LIBSDBFS_USER_H__ */
sdb-lib/libsdbfs.h
View file @
2645bc1b
...
...
@@ -72,20 +72,4 @@ int sdbfs_fread(struct sdbfs *fs, int offset, void *buf, int count);
int
sdbfs_fwrite
(
struct
sdbfs
*
fs
,
int
offset
,
void
*
buf
,
int
count
);
int
sdbfs_ferase
(
struct
sdbfs
*
fs
,
int
offset
,
int
count
);
/* This is needed to convert endianness. Hoping it is not defined elsewhere */
static
inline
uint64_t
htonll
(
uint64_t
ll
)
{
uint64_t
res
;
if
(
htonl
(
1
)
==
1
)
return
ll
;
res
=
htonl
(
ll
>>
32
);
res
|=
(
uint64_t
)(
htonl
((
uint32_t
)
ll
))
<<
32
;
return
res
;
}
static
inline
uint64_t
ntohll
(
uint64_t
ll
)
{
return
htonll
(
ll
);
}
#endif
/* __LIBSDBFS_H__ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment