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 7576351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:53:56+00:00 2026-05-30T16:53:56+00:00

I have a problem with the SLMATH library . Not sure if anyone uses

  • 0

I have a problem with the SLMATH library. Not sure if anyone uses it or has used it before? Anyway, the issue is that when I compile with SSE optimisation enabled (in VS 2010), I obviously have to provide a container that has the correct byte alignment for SSE type objects. This is OK because there’s a little class in SLMATH that’s an aligned vector; it aligns the vector allocation on an 8 byte boundary (i.e. I do not use std::vector<>).

Now the problem is that it appears any structure or class that contains something like slm::mat4 must also be aligned on such a boundary too, before it’s put into a collection. So, for example, I used an aligned vector to create an array of slm::mat4, but if I create a class called Mesh, and Mesh contains an slm::mat4 and I want to put Mesh into a std::vector, well, I get strange memory errors whilst debugging.

So given the documentation is very sparse indeed, can anyone who’s used this library tell me what, precisely, I have to do to use it with SSE optimisation? I mean I don’t like the idea of having to use aligned vectors absolutely everywhere in place of std::vector just in case an slm:: component ends up being encapsulated into a class or structure somehow.

Alternatively, a fast vector/matrix/graphics math library as good as SLMATH would be great if there’s on around.

Thanks for any advice you can offer.

Edit 1: Simple repro-case not using SLMATH illustrates the problem:

#include <vector>

class Item
{

public:

    __declspec(align(8))
    struct {

        float a, b, c, d;

    } Aligned;
};


int main()
{
    // Error - won't compile.

    std::vector<Item> myItems;
}

Robin

  • 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-30T16:53:57+00:00Added an answer on May 30, 2026 at 4:53 pm

    It might work if you when you declare your variable to use __declspec(align) on your variable declarations, or to wrap them within a struct that declares itself to be aligned properly. I have not used the library in question, but it seems that this might be the issue you are facing.

    The reference for the align option can be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem in some JavaScript that I am writing where the Switch statement
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem with fancybox. I want to write a function that will run
I have problem with reading buffer, when reading is not completed. If the received
I have problem I have never met before. I was clearing yesterday clients db
I have problem in Listview onListItemClick() method. I am not getting the position of
I have problem with Activities navigation, searching works good. Activities hierarchy looks like that:
I have problem with this method in NLog library: NLog.Targets.Wrappers.AsyncTargetWrapper.ProcessPendingEvents(object state) It consume too
I have problem running my app on Android 2.3 (Gingerbread). The app has a
I have problem with resized editText (I made him smaller, actually), he has 40dip

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.