On Mon, Mar 25, 2024 at 9:21 PM Robin Jarry <rja...@redhat.com> wrote:
>
> Jerin Jacob, Mar 25, 2024 at 16:47:
> > > #define RTE_NODE_CTX_PTR1(n) ((void **)(n)->ctx)[0]
> > > #define RTE_NODE_CTX_PTR2(n) ((void **)(n)->ctx)[1]
> >
> > Works for me. No strong opinion about the name, RTE_NODE_CTX_AS_PTR1
> > may be more reflecting the intent.
>
> I also thought about adding inline getter/setter functions but that's
> more code. It may be cleaner:
>
>  static inline void *rte_node_ctx_ptr1_get(struct rte_node *n) {
>      return ((void **)node->ctx)[0];
>  }
>  static inline void *rte_node_ctx_ptr2_get(struct rte_node *n) {
>      return ((void **)node->ctx)[1];
>  }
>  static inline void rte_node_ctx_ptr1_set(struct rte_node *n, void *p) {
>      ((void **)node->ctx)[0] = p;
>  }
>  static inline void rte_node_ctx_ptr2_set(struct rte_node *n, void *p) {
>      ((void **)node->ctx)[1] = p;
>  }
>
> I don't have a strong opinion. I'll go either way.

Inline is better.

>

Reply via email to