Advertisement
Guest User

Untitled

a guest
Apr 17th, 2022
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. static inline uint32_t
  2. svp64_field_get(uint32_t value, uint32_t head, uint32_t tail)
  3. {
  4.   const uint32_t mask = ((UINT32_C(1) << (tail - head)) - UINT32_C(1));
  5.  
  6.   return ((value >> head) & mask);
  7. }
  8.  
  9. static inline void
  10. svp64_field_set(uint32_t *value, uint32_t head, uint32_t tail, uint32_t field)
  11. {
  12.   const uint32_t mask = ((UINT32_C(1) << (tail - head)) - UINT32_C(1));
  13.  
  14.   *value |= ((field & mask) << head);
  15. }
  16.  
  17. struct svp64_prefix {
  18.   uint32_t fields;
  19. };
  20.  
  21. static inline uint32_t
  22. svp64_prefix_insn_get(const struct svp64_prefix *prefix)
  23. {
  24.   return svp64_field_get (prefix->fields, 0, 32);
  25. }
  26.  
  27. static inline void
  28. svp64_prefix_insn_set(struct svp64_prefix *prefix, uint32_t insn)
  29. {
  30.   svp64_field_set (&prefix->fields, 0, 32, insn);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement