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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:27:22+00:00 2026-06-16T13:27:22+00:00

I am implementing a code generator that generates specific code for each linear algebra

  • 0

I am implementing a code generator that generates specific code for each
linear algebra expression of the type x = y + w + z or A = B*C + D or whatever.
Each expression is assigned with a unique unsigned long id, and at some point i need to wrap this id to a unique function name.

I have found a similar question but was unable to convert the solution to my problem, as I also have to write this code in C++, and as the valid url name are different from the valid C99function name. I don’t really know where to start!

Edit : I indeed forgot to mention that a function can be assigned multiple 64bit IDs, so converting the ID to string and concatenating the strings may result in a function name too big to be handled by all compilers

Edit 2 :
Okay I was probably not precise enough. I am generating OpenCL code, the generation has the purpose to remove temporaries and reduce kernel launch time. For some reason opencl is based on C99 but some compiles cannot handle very long kernels name ( i had some build errors because of that.)
Considering all possibilities (scalartype, operators, inlined functions, etc…), 64bit for the ID is barely enough, but I think it’s still enough

vec0 = vec1+vec2 has for example ID 1912142123
vec1 = vec0-vec2 has for example ID 3312098234
vec2 = vec0*scal has for example ID 329084089

These three operations can be put in the same kernel. I want to generate the kernel name for the generated code, and _1912142123_3312098234_329084089 might be too long for some compilers.

Hope it’s more clear now

  • 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-16T13:27:24+00:00Added an answer on June 16, 2026 at 1:27 pm

    The following algorithm converts a number using n digits where n is the number of valid characters:

    char *digs = "01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabzdefghijklmnopqrstuvwxyz_";
    int n = strlen(digs);
    
    long id = 1912142123;
    char buffer[16];
    int i = 0;
    do
        buffer[i++] = digs[id%n];
    while((id /= n)>0);
    buffer[i] = 0;
    

    the digs string should contain all valid characters. In this example ‘1912142123’ will be converted to ‘gZEzm1’

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

Sidebar

Related Questions

When implementing the Strategy Pattern, where does one put the code that determines which
My question doesn't pertain to any specific piece of code that I'm working on,
I'm trying to create a random number generator that generates random numbers between two
I'm implementing some code generators, i would like to know if there's any way
I'm implementing a code in matlab to solve quadratic equations, using the resolvent formula:
Am having a number of problems implementing the code from the Washington Post site
My form doesn't have a title bar, so I am implementing the code to
I am implementing a QR code scanner for blackberry devices and I am using
I have the code below implementing a NON-Blocking TCP acceptor. Clients are able to
I've the following code for implementing zoom image in Android: public class MyActivity extends

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.