Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8186395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:10:54+00:00 2026-06-07T02:10:54+00:00

I’m working on translating the code below into Neon Assembly. Any help would be

  • 0

I’m working on translating the code below into Neon Assembly. Any help would be greatly appreciated.

void sum(int length, int *a, int *b, int *c, int *d, char *result)
{
   int i;

   for (i = 0; i < length; i++)
      {
          int sum = (a[i] + b[i] + c[i] + d[i])/4;
          if (sum > threshold)
             result[i] = 1;
          else
             result[i] = 0;
      }
}

The actual code is an image binarization algorithm. The above code is just to demonstrate the idea and not to make simple things more complicate.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:10:56+00:00Added an answer on June 7, 2026 at 2:10 am

    Here’s a fairly straightforward implementation. Note that we convert the divide and threshold test into just a test against threshold * 4 (in order to eliminate the divide):

    void sum(const int n, const int32_t *a, const int32_t *b, const int32_t *c, const int32_t *d, int32_t *result)
    {
       const int32_t threshold4 = threshold * 4;
       const int32x4_t vthreshold4 = { threshold4, threshold4, threshold4, threshold4 };
       const uint32x4_t vk1 = { 1, 1, 1, 1 };
       int i;
    
       for (i = 0; i < n; i += 4)
       {
          int32x4_t va = vld1q_s32(&a[i]);    // load values from a, b, c, d
          int32x4_t vb = vld1q_s32(&b[i]);
          int32x4_t vc = vld1q_s32(&c[i]);
          int32x4_t vd = vld1q_s32(&d[i]);
    
          int32x4_t vsum = vaddq_s32(va, vb); // sum values form a, b, c, d
          vsum = vaddq_s32(vsum, vc);
          vsum = vaddq_s32(vsum, vd);
    
          uint32x4_t vcmp = vcgtq_s32(vsum, vthreshold4);
                                              // compare with threshold * 4
          int32x4_t vresult = (int32x4_t)vandq_u32(vcmp, vk1);
                                              // convert result to 0/1
          vst1q_s32(&result[i], vresult);     // store result
       }
    }
    

    Notes:

    • completely untested code – may need further work
    • result has been changed to int32_t * – it’s not hard to pack down to uint8_t but it adds a lot of complexity to this initial example so I thought I’d keep it simple for now
    • a, b, c, d, result all need to be 16 byte aligned
    • n needs to be a multiple of 4
    • sum of a, b, c, d needs to fit within 32 bit signed int
    • threshold * 4 needs to fit within 32 bit signed int
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.