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

  • Home
  • SEARCH
  • 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 3491178
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:36:21+00:00 2026-05-18T11:36:21+00:00

I am using the following union declaration in SSE2. typedef unsigned long uli; typedef

  • 0

I am using the following union declaration in SSE2.

typedef unsigned long uli;  
typedef uli v4si __attribute__ ((vector_size(16)));  
typedef union  
{  
    v4si v;  
    uli data[2];  
} uliv;  

uliv a, b, c;

The idea is assign two unsigned long variables (64 bit long) to each a and b, XOR them and place the result in c.

An explicit assignment (a.data[0] = something) works here but it requires more time.

I plan to use intrinsics. If I use _mm_set_epi64 (unsigned long x, unsigned long y), it asks for __m64 variables. If I cast these variables (__m64)x and it works fine, but it gives wrong result.

for (k = 0; k < 10; k++)  
{  
    simda.v = _mm_set_epi64 (_mulpre1[u1][k], _mulpre2[u2][k]);  
    simdb.v = _mm_set_epi64 (res1[i+k], res2[i+k]);  
    simdc.v = _mm_xor_si128 (simda.v, simdb.v);  
}

The above code gives error:

/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/emmintrin.h:578: note: expected ‘__m64’
but argument is of type ‘long unsigned int’

Can you please suggest some alternatives (intrinsics)?

  • 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-05-18T11:36:21+00:00Added an answer on May 18, 2026 at 11:36 am

    Are you sure that unsigned long is 64 bits on your system ? It’s probably safer to use unsigned long long or better yet uint64_t from <stdint.h>.

    On my system _mm_set_epi64 takes two unsigned long long parameters and returns an __m128i.

    It’s not clear from your question whether you just want to (a) XOR two 64 bit values or (b) XOR two vectors of 2 x 64 bit values ?

    For case (a) just use scalar code, e.g.

    uint64_t a, b, c;
    
    c = a ^ b;
    

    For case (b) you don’t need unions etc, just do this:

    __m128i va, vb, vc;
    
    va = _mm_set_epi64(a1, a2);
    vb = _mm_set_epi64(b1, b2);
    vc = _mm_xor_si128(va, vb);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the following union typedef, is there a difference in speed between accessing MyPacket.Byte.LB
I have a union as follows: typedef unsigned long GT_U32; typedef unsigned short GT_U16;
I am trying to represent a graph using disjoint union and record. The following
I'm using the following to get data from database in a php file: $query_pedVR
I've no idea if I am using UNION correctly in this scenario - there
The following code: #include <stdio.h> typedef union { int n; char *s; } val_t;
I'm using the following mysql query to return some data from my database. Currently
Please let us consider following code: #include <iostream> using namespace std; union{ int i;
Using following code I try to get updated list of checkbuttons' corresponding text values,
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>

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.