Skip to Main Content
IBM Z Software


This portal is to open public enhancement requests against IBM Z Software products. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Not under consideration
Categories Assembler
Created by Guest
Created on Aug 3, 2016

Improve ability to define structures with power-of-2 size

When writing assembler code, it is often desirable or even necessary to define a structure with a length that is an integral power of 2. Reasons for such might be to avoid crossing a cache-line boundary; to be able to allocate an array of structures without having any single entry cross a page boundary; or to allow indexing to be performed using bit-shift multiplication instead of more expensive MULTIPLY instructions.

In order to accommodate these needs, the following functions should be provided by HLASM development:

- A SETA built-in function that returns the smallest integral power of 2 that is greater than or equal to the input. For example, POW2(15) = 16, POW2(256) = 256, POW2(1234) = 2048, etc.
- A SETA built-in function that returns the integer portion (characteristic) of the base-2 logarithm of the input. For example, LOG(15) = 3, LOG(256) = 8, LOG(1234) = 10, etc.
- Support for an exponentiation operator '**'. Only integral exponents would be required. For example, 2**10 = 1024, 3**3 = 27, etc.

The function names POW2 and LOG are only suggestions; the exponentiation operator '**' has historical precedent but another notation could be used as well.

Idea priority Medium
  • Guest
    Reply
    |
    Sep 17, 2020

    This RFE is one of a small group which had apparently been set aside incorrectly years ago and subsequently overlooked. We are sorry for the delay.

    We understand it would be useful to have power-of-two functions in the language, and this has been on our requirements list for a very long time. For the macro language, such functions can already be achieved by macro coding, provided that the input values for the calculation are available at macro time. They would probably be even more useful in the assembler language, where calculations could be performed on values that are not predefined. However, this would require major new syntax enhancements.

    The suggestion for a log base 2 function has been considered, but as that is mathematically undefined for zero or negative numbers, we have been considering an alternative suggestion which is the bit length of the binary value (with leading zeroes suppressed), which is easier to understand and more assembler-oriented. It is however still unclear how to treat negative numbers in that case. Also, instead of a function to apply a power of 2, we have been considering left and right shift operators.

    The proposed syntax of the exponentiation operator as "2**n" is slightly problematic because "**" is currently parsed as a reference to the location counter, but as HLASM does not currently accept any such reference as valid (not even "0**" or "1**") it should be possible to modify the parsing.

    The main reason why no such enhancement has been done already is that it would require major changes to Assembler internals. For example, the original Assembler H design allocated internal codes for each of the supported assembler and conditional assembly operations, with codes assigned according to their operator priority, but all of the codes in the normal range have now been used up and any new functions have to be implemented as complex special cases.

    The priority for new SETA functions as requested is very low because this can already be done with a few extra lines of code, and although the priority for similar Assembler functions is high, the difficulty is also very high, and we do not expect to look at this in the near future. In the long term, we would hope to address these requirements as part of a major development item to enhance expression processing (perhaps for example to support 63-bit signed expressions). However, for now we must decline this request.

    Regards, Jonathan Scott, HLASM