Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Help on " ne10_result_t(* ne10_add_float)(ne10_float32_t *dst,ne10_float32_t *src1, ne10_float32_t *src2, ne10_uint32_t count)"

Reply
Thread Tools

Help on " ne10_result_t(* ne10_add_float)(ne10_float32_t *dst,ne10_float32_t *src1, ne10_float32_t *src2, ne10_uint32_t count)"

 
 
fl
Guest
Posts: n/a
 
      01-13-2014
Hi,

I am learning ARM NEON library libNE10.a. It has the following variable definition. It is difficult for me to understand it. Could you explain it to me?

ne10_result_t is the return type.

What is "ne10_add_float"?

Thanks,


....................
ne10_result_t(* ne10_add_float)(ne10_float32_t *dst, ne10_float32_t *src1, ne10_float32_t *src2, ne10_uint32_t count)

Adds the elements of src1 to the elements of src2 and stores the results in the dst.

This function point could be pointed to one of ne10_add_float_c, ne10_add_float_neon and ne10_add_float_asm.

Parameters:
[out] dst Pointer to the destination array
[in] src1 The first array to use as the input array
[in] src2 The second array to use as the input array
[in] count The number of items in the two input arrays

Definition at line 248 of file NE10_init_math.c.
 
Reply With Quote
 
 
 
 
Ike Naar
Guest
Posts: n/a
 
      01-13-2014
On 2014-01-13, fl <(E-Mail Removed)> wrote:
> I am learning ARM NEON library libNE10.a.
> It has the following variable definition.
> It is difficult for me to understand it. Could you explain it to me?
>
> ne10_result_t is the return type.
>
> What is "ne10_add_float"?
>
> ne10_result_t(*ne10_add_float)(ne10_float32_t *dst,
> ne10_float32_t *src1,
> ne10_float32_t *src2,
> ne10_uint32_t count)
>
> Adds the elements of src1 to the elements of src2
> and stores the results in the dst.
>
> This function point[er] could be pointed to one of
> ne10_add_float_c, ne10_add_float_neon and ne10_add_float_asm.


ne10_add_float is a pointer to a function that takes parameters of type
(ne10_float32_t*,ne10_float32_t*,ne10_float32_t*,n e10_uint32_t) and that
returns an ne10_result_t.

The idea is that, at the beginning of your program, you can choose which
variant (ne10_add_float_c, ne10_add_float_neon, ne10_add_float_asm) you
want to use in the rest of the program, by means of a simple assignment.

After, say,

ne10_add_float = ne10_add_float_c;

all calls to ne10_add_float will use ne10_add_float_c.

If you want to use ne10_add_float_asm instead of ne10_add_float_c,
you'll only have to change the assignment to

ne10_add_float = ne10_add_float_asm;

and after that, all calls to ne10_add_float will use ne10_add_float_asm.
 
Reply With Quote
 
 
 
 
BartC
Guest
Posts: n/a
 
      01-13-2014


"fl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> ne10_result_t is the return type.
>
> What is "ne10_add_float"?


> ne10_result_t(* ne10_add_float)(ne10_float32_t *dst, ne10_float32_t *src1,
> ne10_float32_t *src2, ne10_uint32_t count)


For complex type declarations I sometimes use a CDECL program to untangle
them and explain what they mean in English (eg. there's an online version
here: http://www.lemoda.net/c/cdecl/index.cgi).

Unfortunately that doesn't understand the typedefs used, so it's necessary
to replace them by standard types such as float and int, although by the
time you've done that, it may already be much clearer!

The naming scheme above is also poor and it makes it harder to figure out
what is the name of a type, and what is the name of the function (or
variable as it turns out), as most names contain 'float'.

Anyway, in your example, ne10_add_float is apparently a variable containing
a pointer to a function. The variable doesn't have a return type, but the
function will do when it's called.

--
Bartc

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-13-2014
"BartC" <(E-Mail Removed)> writes:
> "fl" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> ne10_result_t is the return type.
>>
>> What is "ne10_add_float"?

>
>> ne10_result_t(* ne10_add_float)(ne10_float32_t *dst, ne10_float32_t *src1,
>> ne10_float32_t *src2, ne10_uint32_t count)

[snip]
> The naming scheme above is also poor and it makes it harder to figure out
> what is the name of a type, and what is the name of the function (or
> variable as it turns out), as most names contain 'float'.


All the type names end with "_t".

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
BartC
Guest
Posts: n/a
 
      01-13-2014


"Keith Thompson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "BartC" <(E-Mail Removed)> writes:
>> "fl" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> ne10_result_t is the return type.
>>>
>>> What is "ne10_add_float"?

>>
>>> ne10_result_t(* ne10_add_float)(ne10_float32_t *dst, ne10_float32_t
>>> *src1,
>>> ne10_float32_t *src2, ne10_uint32_t count)

> [snip]
>> The naming scheme above is also poor and it makes it harder to figure out
>> what is the name of a type, and what is the name of the function (or
>> variable as it turns out), as most names contain 'float'.

>
> All the type names end with "_t".


Are names ending in "_t" reserved to be names of types? If not then you
can't make any assumptions. Even if they are, nothing stops someone using,
for example, "ne10_add_float" as a type name.

--
Bartc

 
Reply With Quote
 
James Kuyper
Guest
Posts: n/a
 
      01-13-2014
On 01/13/2014 12:26 PM, BartC wrote:
>
>
> "Keith Thompson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> "BartC" <(E-Mail Removed)> writes:
>>> "fl" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> ne10_result_t is the return type.
>>>>
>>>> What is "ne10_add_float"?
>>>
>>>> ne10_result_t(* ne10_add_float)(ne10_float32_t *dst, ne10_float32_t
>>>> *src1,
>>>> ne10_float32_t *src2, ne10_uint32_t count)

>> [snip]
>>> The naming scheme above is also poor and it makes it harder to figure out
>>> what is the name of a type, and what is the name of the function (or
>>> variable as it turns out), as most names contain 'float'.

>>
>> All the type names end with "_t".

>
> Are names ending in "_t" reserved to be names of types?


If you #include one of it's headers, POSIX does indeed reserve such
names to the implementation, for use as data types. Paradoxically, this
has led many people to follow the same convention in their own type
names, even though doing so violates that reservation.
 
Reply With Quote
 
Kaz Kylheku
Guest
Posts: n/a
 
      01-13-2014
On 2014-01-13, BartC <(E-Mail Removed)> wrote:
> Are names ending in "_t" reserved to be names of types?


No; this is some fantasy of the pitiful morons who look after POSIX.
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-13-2014
"BartC" <(E-Mail Removed)> writes:
> "Keith Thompson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> "BartC" <(E-Mail Removed)> writes:
>>> "fl" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> ne10_result_t is the return type.
>>>>
>>>> What is "ne10_add_float"?
>>>
>>>> ne10_result_t(* ne10_add_float)(ne10_float32_t *dst,
>>>> ne10_float32_t *src1,
>>>> ne10_float32_t *src2, ne10_uint32_t count)

>> [snip]
>>> The naming scheme above is also poor and it makes it harder to figure out
>>> what is the name of a type, and what is the name of the function (or
>>> variable as it turns out), as most names contain 'float'.

>>
>> All the type names end with "_t".

>
> Are names ending in "_t" reserved to be names of types? If not then
> you can't make any assumptions. Even if they are, nothing stops
> someone using, for example, "ne10_add_float" as a type name.


My point was merely that *in the example*, all the type names end with
"_t", so it's not at all hard to figure out which names refer to types
vs. variables. Functions vs. variables may be another matter, but
choosing descriptive names for both should address that.

(POSIX does, as I recall, reserve identifiers with the a "_t" suffix for
its own use; C does not.)

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
BartC
Guest
Posts: n/a
 
      01-14-2014
"Keith Thompson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "BartC" <(E-Mail Removed)> writes:
>> "Keith Thompson" <(E-Mail Removed)> wrote in message


>>> All the type names end with "_t".

>>
>> Are names ending in "_t" reserved to be names of types? If not then
>> you can't make any assumptions. Even if they are, nothing stops
>> someone using, for example, "ne10_add_float" as a type name.

>
> My point was merely that *in the example*, all the type names end with
> "_t", so it's not at all hard to figure out which names refer to types
> vs. variables.


But which are the type names? The OP's context as I understood it was that
he didn't understand the syntax (neither did I). You might perhaps see that
some names end with "_t", and some don't, and might guess that those are
types, and might further guess that *all* types in the example (see subject
line) follow that rule.

However at first glance all *I* saw was a mess of "ne10"s and "float"s! Even
written out like this:

T(*a)(T b, T c, T d, T e)

Where T is a definite type, and a...e are other identitifiers, it's not
immediately obvious to some us (ie. those of us for whom CDECL was invented)
what we're looking at.

--
Bartc

 
Reply With Quote
 
James Kuyper
Guest
Posts: n/a
 
      01-14-2014
On 01/14/2014 04:39 AM, BartC wrote:
....
> But which are the type names? The OP's context as I understood it was that
> he didn't understand the syntax (neither did I). You might perhaps see that
> some names end with "_t", and some don't, and might guess that those are
> types, and might further guess that *all* types in the example (see subject
> line) follow that rule.
>
> However at first glance all *I* saw was a mess of "ne10"s and "float"s! Even
> written out like this:
>
> T(*a)(T b, T c, T d, T e)
>
> Where T is a definite type, and a...e are other identitifiers, it's not
> immediately obvious to some us (ie. those of us for whom CDECL was invented)
> what we're looking at.


A general rule that covers most of the C type declaration syntax is that
it mirrors the syntax used when making use of the thing declared. In
this, case, the above declaration means that the expression (*a)(b, d,
d, e) has the type T, so long as b, c, d, and e are all expressions that
are implicitly convertible to type T.
--
James Kuyper
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to understand this function declaration: void ne10_fir_float_neon(const ne10_fir_instance_f32_t *S, ne10_float32_t *pSrc, ne10_float32_t*pDst, ne10_uint32_t blockSize) asm("ne10_fir_float_neon") fl C Programming 5 01-13-2014 12:29 PM
a = [ "1", "2", "3" ] v/s a = new Array ( "1", "2", "3" )identical in all ways? okey Javascript 1 08-25-2009 12:56 PM
Problems with new DST settings. (Help) David_nj_7@mailbolt.com Computer Support 9 03-11-2007 07:58 PM
Count(*) in a Subquery with multiple tables: How does SQL determine which table to generate the Count() from? Kaimuri MCSD 3 12-29-2004 06:38 PM
I am adding a new row to the datagrid dynamically but if i use the Count property of Item it is not showing the count of the new rows being added Praveen Balanagendra via .NET 247 ASP .Net 2 06-06-2004 07:16 AM



Advertisments