This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Function returns structure problem in ARM926

Parents
  • Note: This was originally posted on 5th July 2009 at http://forums.arm.com

    Thanks for your kind and reply..

    Still i couldnt solve my problem,i will explain you logic in my
    application

    struct A
    {
      int k[10]; 
      int l[10];
      int m[10];
    };
    static struct B
    {
      int a[10]; 
      int b[10];
      int c[10];
    };                
    struct B should be static structure because

    I am calling f2() function many times in my suppilcation,so next time when i call the function f2() it should have previous values of f2()so it should be static


    ############  main.c #################
    main()
    {
    f4()
    {
      f3();  frist time
      f3();  second time the values of f2() will use here
    }
    ##############  test.c  #######################
    f3()
    {
      f2();
    }
    #########################################

    In f2() we should modify static strure B vlues,by passing refernce of B to f2() function.In side the function f2() using another structure (structure A),with A object we should modify values and should return updated static data values.

    I should not use static structre vabiles in f2() because inside f2() function i have tight for loops and doing math operation on values,so copy static values to local variable and modify those varibles with math operations and return those varibles to satic structure.

    I should not do math operations on static variables,becuase it will take more core cycles than local varibles, thats why i am copying to another local structe and do math operations.


    Please give me the solution how can i do this..

    waiting for kind reply
Reply
  • Note: This was originally posted on 5th July 2009 at http://forums.arm.com

    Thanks for your kind and reply..

    Still i couldnt solve my problem,i will explain you logic in my
    application

    struct A
    {
      int k[10]; 
      int l[10];
      int m[10];
    };
    static struct B
    {
      int a[10]; 
      int b[10];
      int c[10];
    };                
    struct B should be static structure because

    I am calling f2() function many times in my suppilcation,so next time when i call the function f2() it should have previous values of f2()so it should be static


    ############  main.c #################
    main()
    {
    f4()
    {
      f3();  frist time
      f3();  second time the values of f2() will use here
    }
    ##############  test.c  #######################
    f3()
    {
      f2();
    }
    #########################################

    In f2() we should modify static strure B vlues,by passing refernce of B to f2() function.In side the function f2() using another structure (structure A),with A object we should modify values and should return updated static data values.

    I should not use static structre vabiles in f2() because inside f2() function i have tight for loops and doing math operation on values,so copy static values to local variable and modify those varibles with math operations and return those varibles to satic structure.

    I should not do math operations on static variables,becuase it will take more core cycles than local varibles, thats why i am copying to another local structe and do math operations.


    Please give me the solution how can i do this..

    waiting for kind reply
Children
No data