Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support aligned access for selected Arm processors. #1871

Merged
merged 3 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions libdap4/d4util.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,3 +459,11 @@ NCD4_errorNC(int code, const int line, const char* file)
{
return NCD4_error(code,line,file,nc_strerror(code));
}

d4size_t
NCD4_getcounter(void* p)
{
COUNTERTYPE v;
memcpy(&v,p,sizeof(v));
return (d4size_t)v;
}
10 changes: 10 additions & 0 deletions libdap4/ncd4.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,17 @@ extern int nc__dap4(void);

#undef GETCOUNTER
#undef SKIPCOUNTER

/* Unclear which macros are defined for which compilers.
see: https://sourceforge.net/p/predef/wiki/Architectures/
*/
#if defined(__arm__) && __ARM_ARCH < 8
EXTERNL d4size_t NCD4_getcounter(void* p);
#define GETCOUNTER(p) NCD4_getcounter(p)
#else
#define GETCOUNTER(p) ((d4size_t)*((COUNTERTYPE*)(p)))
#endif /*defined(__arm__) && __ARM_ARCH < 8*/

#define SKIPCOUNTER(p) {p=INCR(p,COUNTERSIZE);}

#undef PUSH
Expand Down