Changes in / [0b0a285:c84dd61]


Ignore:
Files:
30 added
80 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/colby_parsons_MMAth/Makefile

    r0b0a285 rc84dd61  
    5050        figures/nasus_Channel_Contention \
    5151        figures/pyke_Channel_Contention \
     52        figures/pyke_Future \
     53        figures/nasus_Future \
     54        figures/pyke_Contend_2 \
     55        figures/pyke_Contend_4 \
     56        figures/pyke_Contend_8 \
     57        figures/pyke_Spin_2 \
     58        figures/pyke_Spin_4 \
     59        figures/pyke_Spin_8 \
     60        figures/nasus_Contend_2 \
     61        figures/nasus_Contend_4 \
     62        figures/nasus_Contend_8 \
     63        figures/nasus_Spin_2 \
     64        figures/nasus_Spin_4 \
     65        figures/nasus_Spin_8 \
    5266}
    5367
  • doc/theses/colby_parsons_MMAth/benchmarks/actors/cfa/balance.cfa

    r0b0a285 rc84dd61  
    3333allocation receive( d_actor & this, start_msg & msg ) with( this ) {
    3434    for ( i; Set ) {
    35         *actor_arr[i + gstart] << shared_msg;
     35        *actor_arr[i + gstart] | shared_msg;
    3636    }
    3737    return Nodelete;
     
    4242    if ( recs % Batch == 0 ) {
    4343        for ( i; Batch ) {
    44             *actor_arr[gstart + sends % Set] << shared_msg;
     44            *actor_arr[gstart + sends % Set] | shared_msg;
    4545            sends += 1;
    4646        }
     
    163163    #ifndef MULTI
    164164        for ( i; qpw )
    165                 *actors[i * ActorsPerQueue] << start_send;
     165                *actors[i * ActorsPerQueue] | start_send;
    166166    #else
    167167    for ( i; qpw * ActorProcs ) {
    168                 *actors[i * ActorsPerQueue] << start_send;
     168                *actors[i * ActorsPerQueue] | start_send;
    169169    }
    170170    #endif
    171171   
    172172    for ( i; FillActors )
    173         *filler_actors[i] << shared_msg;
     173        *filler_actors[i] | shared_msg;
    174174
    175175    stop_actor_system();
  • doc/theses/colby_parsons_MMAth/benchmarks/actors/cfa/dynamic.cfa

    r0b0a285 rc84dd61  
    3333    derived_actor * d_actor = malloc();
    3434    (*d_actor){};
    35     *d_actor << *d_msg;
     35    *d_actor | *d_msg;
    3636    return Delete;
    3737}
     
    6262    derived_actor * d_actor = malloc();
    6363    (*d_actor){};
    64     *d_actor << *d_msg;
     64    *d_actor | *d_msg;
    6565
    6666
  • doc/theses/colby_parsons_MMAth/benchmarks/actors/cfa/executor.cfa

    r0b0a285 rc84dd61  
    2929    if ( recs % Batch == 0 ) {
    3030        for ( i; Batch ) {
    31             gstart[sends % Set] << shared_msg;
     31            gstart[sends % Set] | shared_msg;
    3232            sends += 1;
    3333        }
     
    9494
    9595        for ( i; Actors ) {
    96                 actors[i] << shared_msg;
     96                actors[i] | shared_msg;
    9797        } // for
    9898
  • doc/theses/colby_parsons_MMAth/benchmarks/actors/cfa/matrix.cfa

    r0b0a285 rc84dd61  
    103103
    104104        for ( unsigned int r = 0; r < xr; r += 1 ) {
    105                 actors[r] << messages[r];
     105                actors[r] | messages[r];
    106106        } // for
    107107
  • doc/theses/colby_parsons_MMAth/benchmarks/actors/cfa/repeat.cfa

    r0b0a285 rc84dd61  
    4646
    4747Client * cl;
    48 allocation receive( Server & this, IntMsg & msg ) { msg.val = 7; *cl << msg; return Nodelete; }
    49 allocation receive( Server & this, CharMsg & msg ) { msg.val = 'x'; *cl << msg; return Nodelete; }
     48allocation receive( Server & this, IntMsg & msg ) { msg.val = 7; *cl | msg; return Nodelete; }
     49allocation receive( Server & this, CharMsg & msg ) { msg.val = 'x'; *cl | msg; return Nodelete; }
    5050allocation receive( Server & this, StateMsg & msg ) { return Finished; }
    5151
    5252void terminateServers( Client & this ) with(this) {
    5353    for ( i; Messages ) {
    54         servers[i] << stateMsg;
     54        servers[i] | stateMsg;
    5555    } // for
    5656}
     
    6060    if ( times == Times ) { terminateServers( this ); return Finished; }
    6161    results = 0;
    62     this << stateMsg;
     62    this | stateMsg;
    6363    return Nodelete;
    6464}
     
    7474allocation receive( Client & this, StateMsg & msg ) with(this) {
    7575    for ( i; Messages ) {
    76         servers[i] << intmsg[i];
    77         servers[i] << charmsg[i];
     76        servers[i] | intmsg[i];
     77        servers[i] | charmsg[i];
    7878    }
    7979    return Nodelete;
     
    124124    Client client;
    125125    cl = &client;
    126     client << stateMsg;
     126    client | stateMsg;
    127127
    128128    stop_actor_system();
  • doc/theses/colby_parsons_MMAth/benchmarks/actors/cfa/static.cfa

    r0b0a285 rc84dd61  
    2929    }
    3030    msg.cnt++;
    31     receiver << msg;
     31    receiver | msg;
    3232    return Nodelete;
    3333}
     
    5858    derived_actor actor;
    5959
    60     actor << msg;
     60    actor | msg;
    6161
    6262    stop_actor_system();
  • doc/theses/colby_parsons_MMAth/benchmarks/actors/plotData.py

    r0b0a285 rc84dd61  
    166166                    for idx, arr in enumerate(data):
    167167                        plt.errorbar( procs, arr, [bars[idx][0], bars[idx][1]], capsize=2, marker=next(marker) )
     168                    marker = itertools.cycle(('o', 's', 'D', 'x', 'p', '^', 'h', '*', 'v' ))
    168169                    if currBench == Bench.Executor or currBench == Bench.Matrix or currBench == Bench.Balance_One or currBench == Bench.Repeat:
    169170                        plt.yscale("log")
  • doc/theses/colby_parsons_MMAth/benchmarks/channels/plotData.py

    r0b0a285 rc84dd61  
    130130                for idx, arr in enumerate(data):
    131131                    plt.errorbar( procs, arr, [bars[idx][0], bars[idx][1]], capsize=2, marker=next(marker) )
    132                
     132                marker = itertools.cycle(('o', 's', 'D', 'x', 'p', '^', 'h', '*', 'v' ))
    133133                plt.yscale("log")
    134134                # plt.ylim(1, None)
  • doc/theses/colby_parsons_MMAth/benchmarks/mutex_stmt/plotData.py

    r0b0a285 rc84dd61  
    103103                for idx, arr in enumerate(data):
    104104                    plt.errorbar( procs, arr, [bars[idx][0], bars[idx][1]], capsize=2, marker=next(marker) )
     105                marker = itertools.cycle(('o', 's', 'D', 'x', 'p', '^', 'h', '*', 'v' ))
    105106                plt.yscale("log")
    106107                plt.xticks(procs)
  • doc/theses/colby_parsons_MMAth/glossary.tex

    r0b0a285 rc84dd61  
    3737\newabbreviation{toctou}{TOCTOU}{\Newterm{time-of-check to time-of-use}}
    3838
    39 \newglossaryentry{actor}
    40 {
     39\newglossaryentry{actor}{
    4140name=actor,
    4241description={A basic unit of an actor system that can store local state and send messages to other actors.}
    4342}
    4443
    45 \newglossaryentry{gulp}
    46 {
    47 name=gulp,
     44\newglossaryentry{gulp}{
     45name={gulp},
     46first={\Newterm{gulp}},
    4847description={Move the contents of message queue to a local queue of the executor thread using a single atomic instruction.}
    4948}
    5049
    51 \newglossaryentry{impl_concurrency}
    52 {
     50\newglossaryentry{impl_concurrency}{
    5351name=implicit concurrency,
     52first={\Newterm{implicit concurrency}},
    5453description={A class of concurrency features that abstract away explicit thread synchronization and mutual exclusion.}
    5554}
    5655
    57 \newglossaryentry{actor_model}
    58 {
     56\newglossaryentry{actor_model}{
    5957name=actor model,
     58first={\Newterm{actor model}},
    6059description={A concurrent computation model, where tasks are broken into units of work that are distributed to actors in the form of messages.}
    6160}
    6261
    63 \newglossaryentry{actor_system}
    64 {
     62\newglossaryentry{actor_system}{
    6563name=actor system,
     64first={\Newterm{actor system}},
    6665description={An implementation of the actor model.}
    6766}
    6867
    69 \newglossaryentry{synch_multiplex}
    70 {
     68\newglossaryentry{synch_multiplex}{
    7169name=synchronous multiplexing,
     70first={\Newterm{synchronous multiplexing}},
    7271description={synchronization on some subset of a set of resources.}
    7372}
  • doc/theses/colby_parsons_MMAth/local.bib

    r0b0a285 rc84dd61  
    100100}
    101101
     102@misc{go:sched,
     103  author = "The Go Programming Language",
     104  title = "src/runtime/proc.go",
     105  howpublished = {\href{https://go.dev/src/runtime/proc.go}},
     106  note = "[Online; accessed 23-May-2023]"
     107}
     108
    102109@misc{go:selectref,
    103110  author = "The Go Programming Language Specification",
  • doc/theses/colby_parsons_MMAth/text/actors.tex

    r0b0a285 rc84dd61  
    77% C_TODO: add citations throughout chapter
    88Actors are an indirect concurrent feature that abstracts threading away from a programmer, and instead provides \gls{actor}s and messages as building blocks for concurrency, where message passing means there is no shared data to protect, making actors amenable in a distributed environment.
    9 Actors are another message passing concurrency feature, similar to channels but with more abstraction, and are in the realm of \gls{impl_concurrency}, where programmers write concurrent code without dealing with explicit thread create or interaction.
     9Actors are another message passing concurrency feature, similar to channels but with more abstraction, and are in the realm of \gls{impl_concurrency}, where programmers write concurrent code without dealing with explicit thread creation or interaction.
    1010The study of actors can be broken into two concepts, the \gls{actor_model}, which describes the model of computation and the \gls{actor_system}, which refers to the implementation of the model.
    1111Before discussing \CFA's actor system in detail, it is important to first describe the actor model, and the classic approach to implementing an actor system.
     
    2121An actor is executed by an underlying \Newterm{executor} (kernel thread-pool) that fairly invokes each actor, where an actor invocation processes one or more messages from its mailbox.
    2222The default number of executor threads is often proportional to the number of computer cores to achieve good performance.
    23 An executor is often tunable with respect to the number of kernel threads and its scheduling algorithm, which optimize for specific actor applications and workloads \see{end of Section~\ref{s:CFAActorSyntax}}.
    24 
    25 \section{Classic Actor System}
     23An executor is often tunable with respect to the number of kernel threads and its scheduling algorithm, which optimize for specific actor applications and workloads \see{end of Section~\ref{s:CFAActor}}.
     24
     25\subsection{Classic Actor System}
    2626An implementation of the actor model with a community of actors is called an actor system.
    2727Actor systems largely follow the actor model, but can differ in some ways.
     
    4545\end{figure}
    4646
    47 \section{\CFA Actors}
     47\subsection{\CFA Actor System}
    4848Figure~\ref{f:standard_actor} shows an actor system designed as \Newterm{actor-centric}, where a set of actors are scheduled and run on underlying executor threads~\cite{CAF,Akka,ProtoActor}.
    4949The simplest design has a single global queue of actors accessed by the executor threads, but this approach results in high contention as both ends of the queue by the executor threads.
     
    9292\end{enumerate}
    9393
    94 \section{\CFA Actor Syntax}\label{s:CFAActorSyntax}
     94\section{\CFA Actor}\label{s:CFAActor}
    9595\CFA is not an object oriented language and it does not have \gls{rtti}.
    9696As such, all message sends and receives among actors can only occur using static type-matching, as in Typed-Akka~\cite{AkkaTyped}.
     
    146146// messages
    147147struct str_msg {
    148         @inline message;@                                               $\C{// Plan-9 C nominal inheritance}$
    149148        char str[12];
     149        @inline message;@                                               $\C{// Plan-9 C inheritance}$
    150150};
    151151void ?{}( str_msg & this, char * str ) { strcpy( this.str, str ); }  $\C{// constructor}$
    152152struct int_msg {
    153         @inline message;@                                               $\C{// Plan-9 C nominal inheritance}$
    154153        int i;
     154        @inline message;@                                               $\C{// Plan-9 C inheritance}$
    155155};
    156 void ?{}( int_msg & this, int i ) { this.i = i; }       $\C{// constructor}$
    157156// behaviours
    158 allocation receive( my_actor &, @str_msg & msg@ ) {
    159         sout | "string message \"" | msg.str | "\"";
     157allocation receive( my_actor &, @str_msg & msg@ ) with(msg) {
     158        sout | "string message \"" | str | "\"";
    160159        return Nodelete;                                                $\C{// actor not finished}$
    161160}
    162 allocation receive( my_actor &, @int_msg & msg@ ) {
    163         sout | "integer message" | msg.i;
     161allocation receive( my_actor &, @int_msg & msg@ ) with(msg) {
     162        sout | "integer message" | i;
    164163        return Nodelete;                                                $\C{// actor not finished}$
    165164}
    166165int main() {
     166        str_msg str_msg{ "Hello World" };               $\C{// constructor call}$
     167        int_msg int_msg{ 42 };                                  $\C{// constructor call}$
    167168        start_actor_system();                                   $\C{// sets up executor}$
    168169        my_actor actor;                                                 $\C{// default constructor call}$
    169         str_msg str_msg{ "Hello World" };               $\C{// constructor call}$
    170         int_msg int_msg{ 42 };                                  $\C{// constructor call}$
    171         @actor << str_msg << int_msg;@                  $\C{// cascade sends}$
    172         @actor << int_msg;@                                             $\C{// send}$
    173         @actor << finished_msg;@                                $\C{// send => terminate actor (deallocation deferred)}$
     170        @actor | str_msg | int_msg;@                    $\C{// cascade sends}$
     171        @actor | int_msg;@                                              $\C{// send}$
     172        @actor | finished_msg;@                                 $\C{// send => terminate actor (deallocation deferred)}$
    174173        stop_actor_system();                                    $\C{// waits until actors finish}\CRT$
    175174} // deallocate int_msg, str_msg, actor
    176175\end{cfa}
    177176\caption{\CFA Actor Syntax}
    178 \label{f:CFAActorSyntax}
    179 \end{figure}
    180 
    181 Figure~\ref{f:CFAActorSyntax} shows a complete \CFA actor example starting with the actor type @my_actor@ created by defining a @struct@ that inherits from the base @actor@ @struct@ via the @inline@ keyword.
    182 This inheritance style is the Plan-9 C-style nominal inheritance discussed in Section~\ref{s:Inheritance}.
     177\label{f:CFAActor}
     178\end{figure}
     179
     180Figure~\ref{f:CFAActor} shows a complete \CFA actor example starting with the actor type @my_actor@ created by defining a @struct@ that inherits from the base @actor@ @struct@ via the @inline@ keyword.
     181This inheritance style is the Plan-9 C-style inheritance discussed in Section~\ref{s:Inheritance}.
    183182Similarly, the message types @str_msg@ and @int_msg@ are created by defining a @struct@ that inherits from the base @message@ @struct@ via the @inline@ keyword.
    184 Both message types have constructors to set the message value.
     183Only @str_msg@ needs a constructor to copy the C string;
     184@int_msg@ is initialized using its \CFA auto-generated constructors.
    185185There are two matching @receive@ (behaviour) routines that process the corresponding typed messages.
    186 The program main begins by calling @start_actor_system@ to start the actor implementation, including executor threads to run the actors.
    187 An actor and two messages are created on the stack, and four messages are sent to the actor using operator @<<@.
    188 The last message is the builtin @finish_msg@, which returns @Finished@ to an executor thread, which removes the actor from the actor system \see{Section~\ref{s:ActorBehaviours}}.
    189 The call to @stop_actor_system@ blocks program main until all actors are finished and removed from the actor system.
    190 The program main ends by deleting the actor and messages from the stack.
     186Both @receive@ routines use a @with@ clause so message fields are not qualified and return @Nodelete@ indicating the actor is not finished.
     187Also, all messages are marked with @Nodelete@ as their default allocation state.
     188The program main begins by creating two messages on the stack.
     189Then the executor system is started by calling @start_actor_system@.
     190Now an actor is created on the stack and four messages are sent it using operator @?|?@.
     191The last message is the builtin @finish_msg@, which returns @Finished@ to an executor thread, causing it to removes the actor from the actor system \see{Section~\ref{s:ActorBehaviours}}.
     192The call to @stop_actor_system@ blocks the program main until all actors are finished and removed from the actor system.
     193The program main ends by deleting the actor and two messages from the stack.
    191194The output for the program is:
    192195\begin{cfa}
     
    237240Note, it is safe to construct an actor or message with a status other than @Nodelete@, since the executor only examines the allocation action after a behaviour returns.
    238241
     242\subsection{Actor Envelopes}\label{s:envelope}
     243As stated, each message, regardless of where it is allocated, can be sent to an arbitrary number of actors, and hence, appear on an arbitrary number of message queues.
     244Because a C program manages message lifetime, messages cannot be copied for each send, otherwise who manages the copies.
     245Therefore, it up to the actor program to manage message life-time across receives.
     246However, for a message to appear on multiple message queues, it needs an arbitrary number of associated destination behaviours.
     247Hence, there is the concept of an envelop, which is dynamically allocated on each send, that wraps a message with any extra implementation fields needed to persist between send and receive.
     248Managing the envelop is straightforward because it is created at the send and deleted after the receive, \ie there is 1:1 relationship for an envelop and a many to one relationship for a message.
     249
     250% In actor systems, messages are sent and received by actors.
     251% When a actor receives a message it executes its behaviour that is associated with that message type.
     252% However the unit of work that stores the message, the receiving actor's address, and other pertinent information needs to persist between send and the receive.
     253% Furthermore the unit of work needs to be able to be stored in some fashion, usually in a queue, until it is executed by an actor.
     254% All these requirements are fulfilled by a construct called an envelope.
     255% The envelope wraps up the unit of work and also stores any information needed by data structures such as link fields.
     256
     257% One may ask, "Could the link fields and other information be stored in the message?".
     258% This is a good question to ask since messages also need to have a lifetime that persists beyond the work it delivers.
     259% However, if one were to use messages as envelopes then a message would not be able to be sent to multiple actors at a time.
     260% Therefore this approach would just push the allocation into another location, and require the user to dynamically allocate a message for every send, or require careful ordering to allow for message reuse.
     261
    239262\subsection{Actor System}\label{s:ActorSystem}
    240263The calls to @start_actor_system@, and @stop_actor_system@ mark the start and end of a \CFA actor system.
     
    258281All actors must be created \emph{after} calling @start_actor_system@ so the executor can keep track of the number of actors that have entered the system but not yet terminated.
    259282
    260 % All message sends are done using the left-shift operator, @<<@, similar to the syntax of \CC's stream output.
    261 % \begin{cfa}
    262 % allocation ?<<?( my_actor & receiver, my_msg & msg )
    263 % \end{cfa}
    264 % Notice this signature is the same as the @receive@ routine, which is no coincidence.
    265 % The \CFA compiler generates a @?<<?@ routine definition and forward declaration for each @receive@ routine that has the appropriate signature.
    266 % The generated routine packages the message and actor in an \hyperref[s:envelope]{envelope} and adds it to the executor's queues via an executor routine.
    267 % As part of packaging the envelope, the @?<<?@ routine sets a routine pointer in the envelope to point to the appropriate receive routine for given actor and message types.
    268 
    269283\subsection{Actor Send}\label{s:ActorSend}
    270 All message sends are done using the left-shift operator, @<<@, similar to the syntax of \CC's stream output.
     284All message sends are done using the vertical-bar (bit-or) operator, @?|?@, similar to the syntax of the \CFA stream I/O.
     285Hence, programmers must write a matching @?|?@ routine for each @receive@ routine, which is awkward and generates a maintenance problem that must be solved.
     286\CFA's current best approach for creating a generic @?|?@ routine requires users to create routines for their actor and message types that access the base type.
     287Since these routines are not complex, they can be generated using macros that are used to annotate the user-defined actor and message types.
     288This approach is used in \CFA's intrusive list data structure.
     289This is not much better than asking users to write the @?|?@ routine themselves in terms of maintenance, since the user needs to remember the boilerplate macro annotation.
     290
    271291As stated, \CFA does not have named inheritance with RTTI.
    272292\CFA does have a preliminary form of virtual routines, but it is not mature enough for use in this work.
    273 Therefore, there is no mechanism to write a generic @<<@ routine taking a base actor and message type, and then dynamically selecting the @receive@ routine from the actor argument.
    274 (For messages, the Plan-9 inheritance is sufficient because only the inherited fields are needed during the message send.)
    275 Hence, programmers must write a matching @<<@ routine for each @receive@ routine, which is awkward and generates a maintenance problem.
    276 Therefore, I chose to use a template-like approach, where the compiler generates a matching @<<@ routine for each @receive@ routine it finds with an actor/message type-signature.
    277 Then, \CFA uses the type from the left-hand side of an assignment to select the matching receive routine.
     293Virtuals would provide a mechanism to write a single generic @?|?@ routine taking a base actor and message type, that would dynamically select the @receive@ routine from the actor argument.
     294Note, virtuals are not needed for the send; Plan-9 inheritance is sufficient because only the inherited fields are needed during the message send (only upcasting is needed).
     295
     296Therefore, a template-like approach was chosen, where the compiler generates a matching @?|?@ routine for each @receive@ routine it finds with the correct actor/message type-signature.
     297This approach requires no annotation or additional code to be written by users, thus it resolves the maintenance problem.
    278298(When the \CFA virtual routines mature, it should be possible to seamlessly transition to it from the template approach.)
    279299
    280 % Funneling all message sends through a single @allocation ?<<?(actor &, message &)@ routine is not feasible since the type of the actor and message would be erased, making it impossible to acquire a pointer to the correct @receive@.
    281 % As such a @?<<?@ routine per @receive@ provides type information needed to write the correct "address" on the envelope.
    282 
    283 % The left-shift operator routines are generated by the compiler.
    284 An example of a receive routine and its corresponding generated operator routine is shown in Figure~\ref{f:actor_gen}.
    285 Notice the parameter signature of @?<<?@ is the same as the @receive@ routine.
    286 A @?<<?@ routine is generated per @receive@ routine with a matching signature.
    287 The @?<<?@ routine packages the message and actor in an \hyperref[s:envelope]{envelope} and adds it to the executor's queues via the executor routine @send@.
    288 The envelope is conceptually "addressed" to a behaviour, which is stored in the envelope as a function pointer to a @receive@ routine.
    289 The @?<<?@ routines ensure that messages are sent to the right address, \ie sent to the right @receive@ routine based on actor and message type.
     300Figure~\ref{f:send_gen} shows the generated send routine for the @int_msg@ receive in Figure~\ref{f:CFAActor}.
     301Operator @?|?@ has the same parameter signature as the corresponding @receive@ routine and returns an @actor@ so the operator can be cascaded.
     302The routine sets @rec_fn@ to the matching @receive@ routine using the left-hand type to perform the selection.
     303Then the routine packages the base and derived actor and message and actor, along with the receive routine into an \hyperref[s:envelope]{envelope}.
     304Finally, the envelop is added to the executor queue designated by the actor using the executor routine @send@.
    290305
    291306\begin{figure}
    292307\begin{cfa}
    293 $\LstCommentStyle{// from Figure~\ref{f:CFAActorSyntax}}$
    294 struct my_actor { inline actor; };                                      $\C[3.5in]{// actor}$
    295 struct int_msg { inline message; int i; };                      $\C{// message}$
    296 void ?{}( int_msg & this, int i ) { this.i = i; }       $\C{// constructor}$
    297 allocation receive( @my_actor &, int_msg & msg@ ) {     $\C{// receiver}$
    298         sout | "integer message" | msg.i;
    299         return Nodelete;
    300 }
    301 
    302 // compiler generated operator
    303 #define RECEIVER( A, M ) (allocation (*)(actor &, message &))(allocation (*)( A &, M & ))receive
    304 my_actor & ?<<?( @my_actor & receiver, int_msg & msg@ ) {
    305         send( receiver, (request){ &receiver, &msg, RECEIVER( my_actor, int_msg ) } );
     308$\LstCommentStyle{// from Figure~\ref{f:CFAActor}}$
     309struct my_actor { inline actor; };                                              $\C[3.75in]{// actor}$
     310struct int_msg { inline message; int i; };                              $\C{// message}$
     311allocation receive( @my_actor &, int_msg & msg@ ) {...} $\C{// receiver}$
     312
     313// compiler generated send operator
     314typedef allocation (*receive_t)( actor &, message & );
     315actor & ?|?( @my_actor & receiver, int_msg & msg@ ) {
     316        allocation (*rec_fn)( my_actor &, int_msg & ) = @receive@; // deduce receive routine
     317        request req{ &receiver, (actor *)&receiver, &msg, (message *)&msg, (receive_t)rec_fn };
     318        send( receiver, req );                                                          $\C{// queue message for execution}\CRT$
    306319        return receiver;
    307320}
    308321\end{cfa}
    309322\caption{Generated Send Operator}
    310 \label{f:actor_gen}
     323\label{f:send_gen}
     324\end{figure}
     325
     326\subsection{Actor Termination}\label{s:ActorTerm}
     327During a message send, the receiving actor and message being sent are stored via pointers in the envelope.
     328These pointers have the base actor and message types, so type information of the actor and message is lost and then recovered later when the typed receive routine is called.
     329After the receive routine is done, the executor must clean up the actor and message according to their allocation status.
     330If the allocation status is @Delete@ or @Destroy@, the appropriate destructor must be called by the executor.
     331This poses a problem; the correct type of the actor or message is not available to the executor, but it needs to call the right destructor!
     332This requires downcasting from the base type to derived type, which requires a virtual system.
     333Thus, a rudimentary destructor-only virtual system was added to \CFA as part of this work.
     334This virtual system is used via Plan-9 inheritance of the @virtual_dtor@ type, shown in Figure~\ref{f:VirtDtor}.
     335The @virtual_dtor@ type maintains a pointer to the start of the object, and a pointer to the correct destructor.
     336When a type inherits the @virtual_dtor@ type, the compiler adds code to its destructor to make sure that any destructor calls along this segment of the inheritance tree is called are intercepted, and restart at the appropriate destructor for that object.
     337
     338\begin{figure}
     339\begin{cfa}
     340struct base_type { inline virtual_dtor; };
     341struct intermediate_type { inline base_type; };
     342struct derived_type { inline intermediate_type; };
     343
     344int main() {
     345    derived_type d1, d2, d3;
     346    intermediate_type & i = d2;
     347    base_type & b = d3;
     348
     349    // these will call the destructors in the correct order
     350    ^d1{}; ^i{}; ^b{};
     351}
     352
     353\end{cfa}
     354\caption{\CFA Virtual Destructor}
     355\label{f:VirtDtor}
     356\end{figure}
     357
     358This virtual destructor system was built for this work, but is general and can be used in any type in \CFA.
     359Actors and messages opt into this system by inheriting the @virtual_dtor@ type, which allows the executor to call the right destructor without knowing the derived actor or message type.
     360
     361Figure~\ref{f:ConvenienceMessages} shows three builtin convenience messages and receive routines used to terminate actors, depending on how an actor is allocated: @Delete@, @Destroy@ or @Finished@.
     362For example, in Figure~\ref{f:CFAActor}, the builtin @finished_msg@ message and receive are used to terminate the actor because the actor is allocated on the stack, so no deallocation actions are performed by the executor.
     363
     364\begin{figure}
     365\begin{cfa}
     366message __base_msg_finished $@$= { .allocation_ : Finished }; // no auto-gen constructors
     367struct __delete_msg_t { inline message; } delete_msg = __base_msg_finished;
     368struct __destroy_msg_t { inline message; } destroy_msg = __base_msg_finished;
     369struct __finished_msg_t { inline message; } finished_msg = __base_msg_finished;
     370
     371allocation receive( actor & this, __delete_msg_t & msg ) { return Delete; }
     372allocation receive( actor & this, __destroy_msg_t & msg ) { return Destroy; }
     373allocation receive( actor & this, __finished_msg_t & msg ) { return Finished; }
     374\end{cfa}
     375\caption{Builtin Convenience Messages}
     376\label{f:ConvenienceMessages}
    311377\end{figure}
    312378
     
    319385The goal is to achieve better performance and scalability for certain kinds of actor applications by reducing executor locking.
    320386Note, lock-free queues do not help because busy waiting on any atomic instruction is the source of the slowdown whether it is a lock or lock-free.
    321 Work steal now becomes queue stealing, where an entire actor/message queue is stolen, which trivially preserves message ordering in a queue \see{Section~\ref{s:steal}}.
    322387
    323388\begin{figure}
     
    330395
    331396Each executor thread iterates over its own message queues until it finds one with messages.
    332 At this point, the executor thread atomically \gls{gulp}s the queue, meaning move the contents of message queue to a local queue of the executor thread using a single atomic instruction.
    333 This step allows the executor threads to process the local queue without any atomics until the next gulp, while other executor threads are adding in parallel to the end of one of the message queues.
    334 In detail, an executor thread performs a test-and-gulp, non-atomically checking if a queue is non-empty before gulping it.
    335 If a test fails during a message add, the worst-case is cycling through all the message queues.
    336 However, the gain is minimizing costly lock acquisitions.
     397At this point, the executor thread atomically \gls{gulp}s the queue, meaning it moves the contents of message queue to a local queue of the executor thread using a single atomic instruction.
    337398An example of the queue gulping operation is shown in the right side of Figure \ref{f:gulp}, where a executor threads gulps queue 0 and begins to process it locally.
    338 
    339 Processing a local queue involves removing a unit of work from the queue and executing it.
     399This step allows an executor thread to process the local queue without any atomics until the next gulp.
     400Other executor threads can continue adding to the ends of executor thread's message queues.
     401In detail, an executor thread performs a test-and-gulp, non-atomically checking if a queue is non-empty, before attempting to gulp it.
     402If an executor misses an non-empty queue due to a race, it eventually finds the queue after cycling through its message queues.
     403This approach minimizes costly lock acquisitions.
     404
     405Processing a local queue involves: removing a unit of work from the queue, dereferencing the actor pointed-to by the work-unit, running the actor's behaviour on the work-unit message, examining the returned allocation status from the @receive@ routine for the actor and internal status in the delivered message, and taking the appropriate actions.
    340406Since all messages to a given actor are in the same queue, this guarantees atomicity across behaviours of that actor since it can only execute on one thread at a time.
    341 After running a behaviour, the executor thread examines the returned allocation status from the @receive@ routine for the actor and internal status in the delivered message, and takes the appropriate action.
    342 Once all actors have marked themselves as being finished the executor initiates shutdown by inserting a sentinel value into the message queues.
    343 Once a executor threads sees a sentinel it stops running.
    344 After all executors stop running the actor system shutdown is complete.
    345 
    346 \section{Envelopes}\label{s:envelope}
    347 As stated, each message, regardless of where it is allocated, can be sent to an arbitrary number of actors, and hence, appear on an arbitrary number of message queues.
    348 Because a C program manages message lifetime, messages cannot be copied for each send, otherwise who manages the copies.
    349 Therefore, it up to the actor program to manage message life-time across receives.
    350 However, for a message to appear on multiple message queues, it needs an arbitrary number of link fields.
    351 Hence, there is the concept of an envelop, which is dynamically allocated on each send, that wraps a message with any extra implementation fields needed to persist between send and receive.
    352 Managing the envelop is straightforward because it is created at the send and deleted after the receive, \ie there is 1:1 relationship for an envelop and a many to one relationship for a message.
    353 
    354 % In actor systems, messages are sent and received by actors.
    355 % When a actor receives a message it executes its behaviour that is associated with that message type.
    356 % However the unit of work that stores the message, the receiving actor's address, and other pertinent information needs to persist between send and the receive.
    357 % Furthermore the unit of work needs to be able to be stored in some fashion, usually in a queue, until it is executed by an actor.
    358 % All these requirements are fulfilled by a construct called an envelope.
    359 % The envelope wraps up the unit of work and also stores any information needed by data structures such as link fields.
    360 
    361 % One may ask, "Could the link fields and other information be stored in the message?".
    362 % This is a good question to ask since messages also need to have a lifetime that persists beyond the work it delivers.
    363 % However, if one were to use messages as envelopes then a message would not be able to be sent to multiple actors at a time.
    364 % Therefore this approach would just push the allocation into another location, and require the user to dynamically allocate a message for every send, or require careful ordering to allow for message reuse.
    365 
    366 Unfortunately, this frequent allocation of envelopes for each send results in heavy contention on the memory allocator.
    367 As such, a way to alleviate contention on the memory allocator would result in a performance improvement.
    368 Contention is reduced using a novel data structure, called a \Newterm{copy queue}.
     407As each actor is created or terminated by an executor thread, it increments/decrements a global counter.
     408When an executor decrements the counter to zero, it sets a global boolean variable that is checked by each executor thread when it has no work.
     409Once a executor threads sees the flag is set it stops running.
     410After all executors stop, the actor system shutdown is complete.
    369411
    370412\subsection{Copy Queue}\label{s:copyQueue}
     413Unfortunately, the frequent allocation of envelopes for each send results in heavy contention on the memory allocator.
     414This contention is reduced using a novel data structure, called a \Newterm{copy queue}.
    371415The copy queue is a thin layer over a dynamically sized array that is designed with the envelope use case in mind.
    372 A copy queue supports the typical queue operations of push/pop but in a different way than a typical array based queue.
    373 The copy queue is designed to take advantage of the \gls{gulp}ing pattern.
    374 As such, the amortized runtime cost of each push/pop operation for the copy queue is $O(1)$.
     416A copy queue supports the typical queue operations of push/pop but in a different way from a typical array-based queue.
     417
     418The copy queue is designed to take advantage of the \gls{gulp}ing pattern, giving an amortized runtime cost for each push/pop operation of $O(1)$.
    375419In contrast, a na\"ive array-based queue often has either push or pop cost $O(n)$ and the other cost $O(1)$ since one of the operations requires shifting the elements of the queue.
    376420Since the executor threads gulp a queue to operate on it locally, this creates a usage pattern where all elements are popped from the copy queue without any interleaved pushes.
     
    384428For many workload, the copy queues grow in size to facilitate the average number of messages in flight and there is no further dynamic allocations.
    385429One downside of this approach that more storage is allocated than needed, \ie each copy queue is only partially full.
    386 Comparatively, the individual envelope allocations of a list based queue mean that the actor system always uses the minimum amount of heap space and cleans up eagerly.
     430Comparatively, the individual envelope allocations of a list-based queue mean that the actor system always uses the minimum amount of heap space and cleans up eagerly.
    387431Additionally, bursty workloads can cause the copy queues to allocate a large amounts of space to accommodate the peaks of the throughput, even if most of that storage is not needed for the rest of the workload's execution.
    388432
     
    390434Initially, the memory reclamation na\"ively reclaims one index of the array per \gls{gulp}, if the array size is above a low fixed threshold.
    391435However, this approach has a problem.
    392 The high memory usage watermark nearly doubled!
    393 The issue can easily be highlighted with an example.
     436The high memory watermark nearly doubled!
     437The issue is highlighted with an example.
    394438Assume a fixed throughput workload, where a queue never has more than 19 messages at a time.
    395439If the copy queue starts with a size of 10, it ends up doubling at some point to size 20 to accommodate 19 messages.
    396440However, after 2 gulps and subsequent reclamations the array size is 18.
    397441The next time 19 messages are enqueued, the array size is doubled to 36!
    398 To avoid this issue a second check is added.
    399 Each copy queue started tracking the utilization of its array size.
     442To avoid this issue, a second check is added.
    400443Reclamation only occurs if less than half of the array is utilized.
    401 In doing this, the reclamation scheme is able to achieve a lower high-watermark and a lower overall memory utilization compared to the non-reclamation copy queues.
    402 However, the use of copy queues still incurs a higher memory cost than list-based queueing.
    403 With the inclusion of a memory reclamation scheme the increase in memory usage is reasonable considering the performance gains and is discussed further in Section~\ref{s:actor_perf}.
     444This check achieves a lower total storage and overall memory utilization compared to the non-reclamation copy queues.
     445However, the use of copy queues still incurs a higher memory cost than list-based queueing, but the increase in memory usage is reasonable considering the performance gains \see{Section~\ref{s:actor_perf}}.
    404446
    405447\section{Work Stealing}\label{s:steal}
    406 Work stealing is a scheduling strategy that attempts to load balance, and increase resource utilization by having idle threads steal work.
    407 There are many parts that make up a work stealing actor scheduler, but the two that will be highlighted in this work are the stealing mechanism and victim selection.
    408 
    409 % C_TODO enter citation for langs
     448Work stealing is a scheduling strategy to provide \Newterm{load balance}.
     449The goal is to increase resource utilization by having idle threads steal work from working threads.
     450While there are multiple parts in work-stealing scheduler, the two important components are victim selection and the stealing mechanism.
     451
    410452\subsection{Stealing Mechanism}
    411 In this discussion of work stealing the worker being stolen from will be referred to as the \textbf{victim} and the worker stealing work will be called the \textbf{thief}.
    412 The stealing mechanism presented here differs from existing work stealing actor systems due the inverted actor system.
    413 Other actor systems such as Akka \cite{} and CAF \cite{} have work stealing, but since they use an classic actor system that is actor-centric, stealing work is the act of stealing an actor from a dequeue.
    414 As an example, in CAF, the sharded actor queue is a set of double ended queues (dequeues).
    415 Whenever an actor is moved to a ready queue, it is inserted into a worker's dequeue.
     453In work stealing, the stealing worker is called the \Newterm{thief} and the stolen-from worker is called the \Newterm{victim}.
     454The stealing mechanism presented here differs from existing work-stealing actor-systems because of the message-centric (inverted) actor-system.
     455Other actor systems, such as Akka~\cite{Akka} and CAF~\cite{CAF}, have work stealing, but use an actor-centric system where stealing is dequeuing from a non-empty ready-queue to an empty ready-queue.
     456As an example, in CAF, the sharded actor queue is a set of double-ended queues (dequeues).
     457When an actor has messages, it is inserted into a worker's dequeue (ready queue).
    416458Workers then consume actors from the dequeue and execute their behaviours.
    417459To steal work, thieves take one or more actors from a victim's dequeue.
    418 This action creates contention on the dequeue, which can slow down the throughput of the victim.
    419 The notion of which end of the dequeue is used for stealing, consuming, and inserting is not discussed since it isn't relevant.
    420 By the pigeon hole principle there are three dequeue operations (push/victim pop/thief pop) that can occur concurrently and only two ends to a dequeue, so work stealing being present in a dequeue based system will always result in a potential increase in contention on the dequeues.
     460By the pigeon hole principle, there are three dequeue operations (push/victim pop/thief pop) that can occur concurrently and only two ends to a dequeue, so work stealing in a dequeue-based system always results in a potential increase in contention on the dequeues.
     461This contention can slows down the victim's throughput.
     462Note, which end of the dequeue is used for stealing, consuming, and inserting is not discussed since the largest cost is the mutual exclusion and its duration for safely performing the queue operations.
     463
     464Work steal now becomes queue stealing, where an entire actor/message queue is stolen, which trivially preserves message ordering in a queue \see{Section~\ref{s:steal}}.
    421465
    422466% C_TODO: maybe insert stealing diagram
    423467
    424 In \CFA, the actor work stealing implementation is unique.
    425 While other systems are concerned with stealing actors, the \CFA actor system steals queues.
    426 This is a result of \CFA's use of the inverted actor system.
    427 The goal of the \CFA actor work stealing mechanism is to have a zero-victim-cost stealing mechanism.
    428 This does not means that stealing has no cost.
    429 This goal is to ensure that stealing work does not impact the performance of victim workers.
    430 This means that thieves can not contend with victims, and that victims should perform no stealing related work unless they become a thief.
    431 In theory this goal is not achieved, but results will be presented that show the goal is achieved in practice.
    432 In \CFA's actor system workers own a set of sharded queues which they iterate over and gulp.
    433 If a worker has iterated over the queues they own twice without finding any work, they try to steal a queue from another worker.
    434 Stealing a queue is done wait-free with a few atomic instructions that can only create contention with other stealing workers.
    435 To steal a queue a worker does the following:
     468In \CFA, the actor work-stealing implementation is unique because of the message-centric system.
     469In this system, it is impractical to steal actors because an actor's messages are distributed in temporal order along the message queue.
     470To ensure sequential actor execution and FIFO message delivery, actor stealing requires finding and removing all of an actor's messages, and inserting them consecutively in another message queue.
     471This operation is $O(N)$ with a non-trivial constant.
     472The only way for work stealing to become practical is to shard the message queue, which also reduces contention, and steal queues to eliminate queue searching.
     473
     474Given queue stealing, the goal is to have a zero-victim-cost stealing mechanism, which does not mean stealing has no cost.
     475It means work stealing does not affect the performance of the victim worker.
     476The implication is that thieves cannot contend with a victim, and that a victim should perform no stealing related work unless it becomes a thief.
     477In theory, this goal is not achievable, but results show the goal is achieved in practice.
     478
     479In \CFA's actor system, workers own a set of sharded queues, which they iterate over and gulp.
     480If a worker has iterated over its message queues twice without finding any work, it tries to steal a queue from another worker.
     481Stealing a queue is done wait-free with a few atomic instructions that can only create contention with other stealing workers, not the victim.
     482To steal a queue, a worker does the following:
    436483\begin{enumerate}[topsep=5pt,itemsep=3pt,parsep=0pt]
    437484\item
    438 The thief chooses a victim.
     485The thief chooses a victim, which is trivial because all workers are stored in a shared array.
    439486
    440487\item
    441488The thief starts at a random index in the array of the victim's queues and searches for a candidate queue.
    442 A candidate queue is any queue that is not empty, is not being stolen by another thief, and is not being processed by the victim.
    443 These are not strictly enforced rules.
    444 The candidate is identified non-atomically and as such queues that do not satisfy these rules may be stolen.
    445 However, steals that do not meet these requirements do not affect correctness so they are allowed and do not constitute failed steals as the queues will still be swapped.
    446 
    447 
    448 \item
    449 Once a candidate queue is chosen, the thief attempts a wait-free swap of the victim's queue and a random on of the thief's queues.
    450 This swap can fail.
    451 If the swap is successful the thief swaps the two queues.
    452 If the swap fails, another thief must have attempted to steal one of the two queues being swapped.
    453 Failing to steal is good in this case since stealing a queue that was just swapped would likely result in stealing an empty queue.
     489A candidate queue is any non-empty queue not being processed by the victim and not being stolen by another thief.
     490These rules are not strictly enforced.
     491A candidate is identified non-atomically, and as such, queues that do not satisfy these rules may be stolen.
     492However, steals not meeting the rules do not affect correctness and do not constitute failed steals as the queue is always swapped.
     493
     494\item
     495Once a candidate queue is chosen, the thief attempts a wait-free swap of a victim's queue to a random empty thief queue.
     496If the swap successes, the steal is completed.
     497If the swap fails, the victim may have been gulping that message queue or another thief must have attempted to steal the victim's queue.
     498In either case, that message queue is highly likely to be empty.
     499
     500\item
     501Once a thief fails or succeeds in stealing a queue, it iterates over its messages queues again because new messages may have arrived during stealing.
     502Stealing is only repeated after two consecutive iterations over its owned queues without finding work.
    454503\end{enumerate}
    455504
    456 Once a thief fails or succeeds in stealing a queue, it goes back to its own set of queues and iterates over them again.
    457 It will only try to steal again once it has completed two consecutive iterations over its owned queues without finding any work.
    458505The key to the stealing mechanism is that the queues can still be operated on while they are being swapped.
    459 This eliminates any contention between thieves and victims.
     506This functionality eliminates any contention among thieves and victims.
     507
    460508The first key to this is that actors and workers maintain two distinct arrays of references to queues.
    461509Actors will always receive messages via the same queues.
     
    606654
    607655\subsection{Stealing Guarantees}
    608 
    609 % C_TODO insert graphs for each proof
    610656Given that the stealing operation can potentially fail, it is important to discuss the guarantees provided by the stealing implementation.
    611657Given a set of $N$ swaps a set of connected directed graphs can be constructed where each vertex is a queue and each edge is a swap directed from a thief queue to a victim queue.
     
    749795Since the @Finished@ allocation status is unused for messages, it is used internally to detect if a message has been sent.
    750796Deallocating a message without sending it could indicate to a user that they are touching freed memory later, or it could point out extra allocations that could be removed.
     797\item Detection of messages sent but not received
     798As discussed in Section~\ref{s:executor}, once all actors have terminated shutdown is communicated to executor threads via a status flag. Upon termination the executor threads check their queues to see if any contain messages. If they do, an error is reported. Messages being sent but not received means that their allocation action did not occur and their payload was not delivered. Missing the allocation action can lead to memory leaks and missed payloads can cause unpredictable behaviour. Detecting this can indicate a race or logic error in the user's code.
    751799\end{itemize}
    752800
  • doc/theses/colby_parsons_MMAth/text/mutex_stmt.tex

    r0b0a285 rc84dd61  
    415415\begin{figure}
    416416        \centering
     417    \captionsetup[subfloat]{labelfont=footnotesize,textfont=footnotesize}
    417418        \subfloat[AMD]{
    418419                \resizebox{0.5\textwidth}{!}{\input{figures/nasus_Aggregate_Lock_2.pgf}}
     
    421422                \resizebox{0.5\textwidth}{!}{\input{figures/pyke_Aggregate_Lock_2.pgf}}
    422423        }
     424    \bigskip
    423425
    424426        \subfloat[AMD]{
     
    428430                \resizebox{0.5\textwidth}{!}{\input{figures/pyke_Aggregate_Lock_4.pgf}}
    429431        }
     432    \bigskip
    430433
    431434        \subfloat[AMD]{
  • driver/cfa.cc

    r0b0a285 rc84dd61  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 30 10:47:52 2023
    13 // Update Count     : 478
     12// Last Modified On : Fri Jun  9 14:36:41 2023
     13// Update Count     : 479
    1414//
    1515
     
    334334        #ifdef __ARM_ARCH
    335335        args[nargs++] = "-mno-outline-atomics";                         // use ARM LL/SC instructions for atomics
     336        // args[nargs++] = "-march=armv8.2-a+lse";                              // use atomic instructions
    336337        #endif // __ARM_ARCH
    337338
  • libcfa/prelude/builtins.c

    r0b0a285 rc84dd61  
    149149
    150150static inline {
    151         long int ?\?( int x, unsigned int y ) { __CFA_EXP__(); }
     151        int ?\?( int x, unsigned int y ) { __CFA_EXP__(); }
    152152        long int ?\?( long int x, unsigned long int y ) { __CFA_EXP__(); }
    153153        long long int ?\?( long long int x, unsigned long long int y ) { __CFA_EXP__(); }
    154154        // unsigned computation may be faster and larger
    155         unsigned long int ?\?( unsigned int x, unsigned int y ) { __CFA_EXP__(); }
     155        unsigned int ?\?( unsigned int x, unsigned int y ) { __CFA_EXP__(); }
    156156        unsigned long int ?\?( unsigned long int x, unsigned long int y ) { __CFA_EXP__(); }
    157157        unsigned long long int ?\?( unsigned long long int x, unsigned long long int y ) { __CFA_EXP__(); }
     
    176176
    177177static inline {
    178         long int ?\=?( int & x, unsigned int y ) { x = x \ y; return x; }
     178        int ?\=?( int & x, unsigned int y ) { x = x \ y; return x; }
    179179        long int ?\=?( long int & x, unsigned long int y ) { x = x \ y; return x; }
    180180        long long int ?\=?( long long int & x, unsigned long long int y ) { x = x \ y; return x; }
    181         unsigned long int ?\=?( unsigned int & x, unsigned int y ) { x = x \ y; return x; }
     181        unsigned int ?\=?( unsigned int & x, unsigned int y ) { x = x \ y; return x; }
    182182        unsigned long int ?\=?( unsigned long int & x, unsigned long int y ) { x = x \ y; return x; }
    183183        unsigned long long int ?\=?( unsigned long long int & x, unsigned long long int y ) { x = x \ y; return x; }
  • libcfa/prelude/sync-builtins.cf

    r0b0a285 rc84dd61  
    206206_Bool __sync_bool_compare_and_swap(volatile unsigned __int128 *, unsigned __int128, unsigned __int128,...);
    207207#endif
     208// for all pointer types
    208209forall(T &) _Bool __sync_bool_compare_and_swap(T * volatile *, T *, T*, ...);
    209210
     
    223224unsigned __int128 __sync_val_compare_and_swap(volatile unsigned __int128 *, unsigned __int128, unsigned __int128,...);
    224225#endif
     226// for all pointer types
    225227forall(T &) T * __sync_val_compare_and_swap(T * volatile *, T *, T*,...);
    226228
     
    326328void __atomic_exchange(volatile unsigned __int128 *, unsigned __int128 *, unsigned __int128 *, int);
    327329#endif
     330// for all pointer types
    328331forall(T &) T * __atomic_exchange_n(T * volatile *, T *, int);
    329332forall(T &) void __atomic_exchange(T * volatile *, T **, T **, int);
     
    359362void __atomic_load(const volatile unsigned __int128 *, unsigned __int128 *, int);
    360363#endif
     364// for all pointer types
    361365forall(T &) T * __atomic_load_n(T * const volatile *, int);
    362366forall(T &) void __atomic_load(T * const volatile *, T **, int);
     
    390394_Bool __atomic_compare_exchange   (volatile unsigned __int128 *, unsigned __int128 *, unsigned __int128 *, _Bool, int, int);
    391395#endif
     396// for all pointer types
    392397forall(T &) _Bool __atomic_compare_exchange_n (T * volatile *, T **, T*, _Bool, int, int);
    393398forall(T &) _Bool __atomic_compare_exchange   (T * volatile *, T **, T**, _Bool, int, int);
     
    423428void __atomic_store(volatile unsigned __int128 *, unsigned __int128 *, int);
    424429#endif
     430// for all pointer types
    425431forall(T &) void __atomic_store_n(T * volatile *, T *, int);
    426432forall(T &) void __atomic_store(T * volatile *, T **, int);
  • libcfa/src/common.hfa

    r0b0a285 rc84dd61  
    3232} // extern "C"
    3333static inline __attribute__((always_inline)) {
    34         unsigned char abs( signed char v ) { return abs( (int)v ); }
     34        unsigned char abs( signed char v ) { return (int)abs( (int)v ); }
    3535        // use default C routine for int
    3636        unsigned long int abs( long int v ) { return labs( v ); }
     
    7070        unsigned int min( unsigned int v1, unsigned int v2 ) { return v1 < v2 ? v1 : v2; }
    7171        long int min( long int v1, long int v2 ) { return v1 < v2 ? v1 : v2; }
    72         unsigned long int min( unsigned long int v1, unsigned int v2 ) { return v1 < v2 ? v1 : v2; }
     72        unsigned long int min( unsigned long int v1, unsigned long int v2 ) { return v1 < v2 ? v1 : v2; }
    7373        long long int min( long long int v1, long long int v2 ) { return v1 < v2 ? v1 : v2; }
    74         unsigned long long int min( unsigned long long int v1, unsigned int v2 ) { return v1 < v2 ? v1 : v2; }
     74        unsigned long long int min( unsigned long long int v1, unsigned long long int v2 ) { return v1 < v2 ? v1 : v2; }
    7575        forall( T | { int ?<?( T, T ); } )                                      // generic
    7676        T min( T v1, T v2 ) { return v1 < v2 ? v1 : v2; }
  • libcfa/src/concurrency/actor.hfa

    r0b0a285 rc84dd61  
    3030#define __DEFAULT_EXECUTOR_BUFSIZE__ 10
    3131
    32 #define __STEAL 0 // workstealing toggle. Disjoint from toggles above
     32#define __STEAL 1 // workstealing toggle. Disjoint from toggles above
    3333
    3434// workstealing heuristic selection (only set one to be 1)
     
    4646enum allocation { Nodelete, Delete, Destroy, Finished }; // allocation status
    4747
    48 typedef allocation (*__receive_fn)(actor &, message &);
     48typedef allocation (*__receive_fn)(actor &, message &, actor **, message **);
    4949struct request {
    5050    actor * receiver;
    5151    message * msg;
    5252    __receive_fn fn;
    53     bool stop;
    5453};
    5554
    56 static inline void ?{}( request & this ) { this.stop = true; } // default ctor makes a sentinel
     55struct a_msg {
     56    int m;
     57};
     58static inline void ?{}( request & this ) {}
    5759static inline void ?{}( request & this, actor * receiver, message * msg, __receive_fn fn ) {
    5860    this.receiver = receiver;
    5961    this.msg = msg;
    6062    this.fn = fn;
    61     this.stop = false;
    6263}
    6364static inline void ?{}( request & this, request & copy ) {
     
    6566    this.msg = copy.msg;
    6667    this.fn = copy.fn;
    67     this.stop = copy.stop;
    6868}
    6969
     
    8383    last_size = 0;
    8484}
    85 static inline void ^?{}( copy_queue & this ) with(this) { adelete(buffer); }
     85static inline void ^?{}( copy_queue & this ) with(this) {
     86    DEBUG_ABORT( count != 0, "Actor system terminated with messages sent but not received\n" );
     87    adelete(buffer);
     88}
    8689
    8790static inline void insert( copy_queue & this, request & elem ) with(this) {
     
    117120}
    118121
    119 static inline bool isEmpty( copy_queue & this ) with(this) { return count == 0; }
     122static inline bool is_empty( copy_queue & this ) with(this) { return count == 0; }
    120123
    121124struct work_queue {
     
    178181    volatile unsigned long long stamp;
    179182    #ifdef ACTOR_STATS
    180     size_t stolen_from, try_steal, stolen, failed_swaps, msgs_stolen;
     183    size_t stolen_from, try_steal, stolen, empty_stolen, failed_swaps, msgs_stolen;
    181184    unsigned long long processed;
    182185    size_t gulps;
     
    191194    this.gulps = 0;                                 // number of gulps
    192195    this.failed_swaps = 0;                          // steal swap failures
     196    this.empty_stolen = 0;                          // queues empty after steal
    193197    this.msgs_stolen = 0;                           // number of messages stolen
    194198    #endif
     
    210214#ifdef ACTOR_STATS
    211215// aggregate counters for statistics
    212 size_t __total_tries = 0, __total_stolen = 0, __total_workers, __all_gulps = 0,
     216size_t __total_tries = 0, __total_stolen = 0, __total_workers, __all_gulps = 0, __total_empty_stolen = 0,
    213217    __total_failed_swaps = 0, __all_processed = 0, __num_actors_stats = 0, __all_msgs_stolen = 0;
    214218#endif
     
    235239        unsigned int nprocessors, nworkers, nrqueues;   // number of processors/threads/request queues
    236240        bool seperate_clus;                                                             // use same or separate cluster for executor
     241    volatile bool is_shutdown;                      // flag to communicate shutdown to worker threads
    237242}; // executor
    238243
     
    248253    __atomic_add_fetch(&__total_stolen, executor_->w_infos[id].stolen, __ATOMIC_SEQ_CST);
    249254    __atomic_add_fetch(&__total_failed_swaps, executor_->w_infos[id].failed_swaps, __ATOMIC_SEQ_CST);
     255    __atomic_add_fetch(&__total_empty_stolen, executor_->w_infos[id].empty_stolen, __ATOMIC_SEQ_CST);
    250256
    251257    // per worker steal stats (uncomment alongside the lock above this routine to print)
     
    274280    this.nrqueues = nrqueues;
    275281    this.seperate_clus = seperate_clus;
     282    this.is_shutdown = false;
    276283
    277284    if ( nworkers == nrqueues )
     
    322329
    323330static inline void ^?{}( executor & this ) with(this) {
    324     #ifdef __STEAL
    325     request sentinels[nrqueues];
    326     for ( unsigned int i = 0; i < nrqueues; i++ ) {
    327         insert( request_queues[i], sentinels[i] );              // force eventually termination
    328     } // for
    329     #else
    330     request sentinels[nworkers];
    331     unsigned int reqPerWorker = nrqueues / nworkers, extras = nrqueues % nworkers;
    332     for ( unsigned int i = 0, step = 0, range; i < nworkers; i += 1, step += range ) {
    333         range = reqPerWorker + ( i < extras ? 1 : 0 );
    334         insert( request_queues[step], sentinels[i] );           // force eventually termination
    335     } // for
    336     #endif
     331    is_shutdown = true;
    337332
    338333    for ( i; nworkers )
     
    365360    size_t avg_gulps = __all_gulps == 0 ? 0 : __all_processed / __all_gulps;
    366361    printf("\tGulps:\t\t\t\t\t%lu\n\tAverage Gulp Size:\t\t\t%lu\n\tMissed gulps:\t\t\t\t%lu\n", __all_gulps, avg_gulps, misses);
    367     printf("\tSteal attempts:\t\t\t\t%lu\n\tSteals:\t\t\t\t\t%lu\n\tSteal failures (no candidates):\t\t%lu\n\tSteal failures (failed swaps):\t\t%lu\n",
    368         __total_tries, __total_stolen, __total_tries - __total_stolen - __total_failed_swaps, __total_failed_swaps);
     362    printf("\tSteal attempts:\t\t\t\t%lu\n\tSteals:\t\t\t\t\t%lu\n\tSteal failures (no candidates):\t\t%lu\n\tSteal failures (failed swaps):\t\t%lu\t Empty steals:\t\t%lu\n",
     363        __total_tries, __total_stolen, __total_tries - __total_stolen - __total_failed_swaps, __total_failed_swaps, __total_empty_stolen);
    369364    size_t avg_steal = __total_stolen == 0 ? 0 : __all_msgs_stolen / __total_stolen;
    370365    printf("\tMessages stolen:\t\t\t%lu\n\tAverage steal size:\t\t\t%lu\n", __all_msgs_stolen, avg_steal);
     
    449444static inline void check_message( message & this ) {
    450445    switch ( this.allocation_ ) {                                               // analyze message status
    451         case Nodelete: CFA_DEBUG(this.allocation_ = Finished); break;
     446        case Nodelete: CFA_DEBUG( this.allocation_ = Finished ); break;
    452447        case Delete: delete( &this ); break;
    453         case Destroy: ^?{}(this); break;
     448        case Destroy: ^?{}( this ); break;
    454449        case Finished: break;
    455450    } // switch
     
    461456static inline void deliver_request( request & this ) {
    462457    DEBUG_ABORT( this.receiver->ticket == (unsigned long int)MAX, "Attempted to send message to deleted/dead actor\n" );
    463     this.receiver->allocation_ = this.fn( *this.receiver, *this.msg );
    464     check_message( *this.msg );
    465     check_actor( *this.receiver );
     458    actor * base_actor;
     459    message * base_msg;
     460    allocation temp = this.fn( *this.receiver, *this.msg, &base_actor, &base_msg );
     461    base_actor->allocation_ = temp;
     462    check_message( *base_msg );
     463    check_actor( *base_actor );
    466464}
    467465
     
    513511        curr_steal_queue = request_queues[ i + vic_start ];
    514512        // avoid empty queues and queues that are being operated on
    515         if ( curr_steal_queue == 0p || curr_steal_queue->being_processed || isEmpty( *curr_steal_queue->c_queue ) )
     513        if ( curr_steal_queue == 0p || curr_steal_queue->being_processed || is_empty( *curr_steal_queue->c_queue ) )
    516514            continue;
    517515
     
    521519            executor_->w_infos[id].msgs_stolen += curr_steal_queue->c_queue->count;
    522520            executor_->w_infos[id].stolen++;
     521            if ( is_empty( *curr_steal_queue->c_queue ) ) executor_->w_infos[id].empty_stolen++;
    523522            // __atomic_add_fetch(&executor_->w_infos[victim_id].stolen_from, 1, __ATOMIC_RELAXED);
    524523            // replaced_queue[swap_idx]++;
     
    560559}
    561560
     561#define CHECK_TERMINATION if ( unlikely( executor_->is_shutdown ) ) break Exit
    562562void main( worker & this ) with(this) {
    563563    // #ifdef ACTOR_STATS
     
    581581       
    582582        // check if queue is empty before trying to gulp it
    583         if ( isEmpty( *curr_work_queue->c_queue ) ) {
     583        if ( is_empty( *curr_work_queue->c_queue ) ) {
    584584            #ifdef __STEAL
    585585            empty_count++;
     
    594594        #endif // ACTOR_STATS
    595595        #ifdef __STEAL
    596         if ( isEmpty( *current_queue ) ) {
    597             if ( unlikely( no_steal ) ) continue;
     596        if ( is_empty( *current_queue ) ) {
     597            if ( unlikely( no_steal ) ) { CHECK_TERMINATION; continue; }
    598598            empty_count++;
    599599            if ( empty_count < steal_threshold ) continue;
    600600            empty_count = 0;
     601
     602            CHECK_TERMINATION; // check for termination
    601603
    602604            __atomic_store_n( &executor_->w_infos[id].stamp, rdtscl(), __ATOMIC_RELAXED );
     
    610612        }
    611613        #endif // __STEAL
    612         while ( ! isEmpty( *current_queue ) ) {
     614        while ( ! is_empty( *current_queue ) ) {
    613615            #ifdef ACTOR_STATS
    614616            executor_->w_infos[id].processed++;
     
    616618            &req = &remove( *current_queue );
    617619            if ( !&req ) continue;
    618             if ( req.stop ) break Exit;
    619620            deliver_request( req );
    620621        }
     
    623624        empty_count = 0; // we found work so reset empty counter
    624625        #endif
     626
     627        CHECK_TERMINATION;
    625628       
    626629        // potentially reclaim some of the current queue's vector space if it is unused
     
    644647    __all_gulps = 0;
    645648    __total_failed_swaps = 0;
     649    __total_empty_stolen = 0;
    646650    __all_processed = 0;
    647651    __num_actors_stats = 0;
     
    657661}
    658662
    659 // TODO: potentially revisit getting number of processors
    660 //  ( currently the value stored in active_cluster()->procs.total is often stale
    661 //  and doesn't reflect how many procs are allocated )
    662 // static inline void start_actor_system() { start_actor_system( active_cluster()->procs.total ); }
    663 static inline void start_actor_system() { start_actor_system( 1 ); }
     663static inline void start_actor_system() { start_actor_system( get_proc_count( *active_cluster() ) ); }
    664664
    665665static inline void start_actor_system( executor & this ) {
     
    671671
    672672static inline void stop_actor_system() {
    673     park( ); // will receive signal when actor system is finished
     673    park( ); // will be unparked when actor system is finished
    674674
    675675    if ( !__actor_executor_passed ) delete( __actor_executor_ );
  • libcfa/src/concurrency/atomic.hfa

    r0b0a285 rc84dd61  
    1010// Created On       : Thu May 25 15:22:46 2023
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun  9 13:36:47 2023
    13 // Update Count     : 46
     12// Last Modified On : Wed Jun 14 07:48:57 2023
     13// Update Count     : 52
    1414//
    1515
     
    3535
    3636// #define CAS( assn, comp, replace ) (CASM( assn, comp, replace, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))
    37 // #define CASM( assn, comp, replace, memorder... ) ({ \
    38 //      typeof(comp) __temp = (comp); \
    39 //      __atomic_compare_exchange_n( &(assn), &(__temp), (replace), false, memorder ); \
    40 // })
     37// #define CASM( assn, comp, replace, memorder... ) ({ typeof(comp) __temp = (comp); __atomic_compare_exchange_n( &(assn), &(__temp), (replace), false, memorder ); })
    4138#define CAS( assn, comp, replace ) (__sync_bool_compare_and_swap( &assn, comp, replace))
    4239#define CASM( assn, comp, replace, memorder... ) _Static_assert( false, "memory order unsupported for CAS macro" );
  • libcfa/src/concurrency/kernel.hfa

    r0b0a285 rc84dd61  
    195195        // Total number of processors
    196196        unsigned total;
     197
     198    // Number of processors constructed
     199    //  incremented at construction time, total is incremented once the processor asyncronously registers
     200        unsigned constructed;
    197201
    198202        // Total number of idle processors
     
    297301static inline struct cluster   * active_cluster  () { return publicTLS_get( this_processor )->cltr; }
    298302
     303// gets the number of constructed processors on the cluster
     304static inline unsigned get_proc_count( cluster & this ) { return this.procs.constructed; }
     305
    299306// set the number of internal processors
    300307// these processors are in addition to any explicitly declared processors
  • libcfa/src/concurrency/kernel/cluster.hfa

    r0b0a285 rc84dd61  
    4040
    4141// convert to log2 scale but using double
    42 static inline __readyQ_avg_t __to_readyQ_avg(unsigned long long intsc) { if(unlikely(0 == intsc)) return 0.0; else return log2(intsc); }
     42static inline __readyQ_avg_t __to_readyQ_avg(unsigned long long intsc) { if(unlikely(0 == intsc)) return 0.0; else return log2((__readyQ_avg_t)intsc); }
    4343
    4444#define warn_large_before warnf( !strict || old_avg < 35.0, "Suspiciously large previous average: %'lf, %'" PRId64 "ms \n", old_avg, program()`ms )
  • libcfa/src/concurrency/kernel/startup.cfa

    r0b0a285 rc84dd61  
    528528        this.name = name;
    529529        this.cltr = &_cltr;
     530    __atomic_add_fetch( &_cltr.procs.constructed, 1u, __ATOMIC_RELAXED );
    530531        this.rdq.its = 0;
    531532        this.rdq.itr = 0;
     
    595596        __cfadbg_print_safe(runtime_core, "Kernel : core %p signaling termination\n", &this);
    596597
     598    __atomic_sub_fetch( &this.cltr->procs.constructed, 1u, __ATOMIC_RELAXED );
     599
    597600        __atomic_store_n(&do_terminate, true, __ATOMIC_RELAXED);
    598601        __disable_interrupts_checked();
     
    615618        this.fdw   = 0p;
    616619        this.idle  = 0;
     620    this.constructed = 0;
    617621        this.total = 0;
    618622}
  • libcfa/src/concurrency/locks.hfa

    r0b0a285 rc84dd61  
    3535#include <linux/futex.h>      /* Definition of FUTEX_* constants */
    3636#include <sys/syscall.h>      /* Definition of SYS_* constants */
    37 #include <unistd.h>
     37#include <unistd.h>           /* Definition of syscall routine */
    3838
    3939typedef void (*__cfa_pre_park)( void * );
  • libcfa/src/fstream.cfa

    r0b0a285 rc84dd61  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun  5 22:00:23 2023
    13 // Update Count     : 518
     12// Last Modified On : Sat Jun 17 08:51:12 2023
     13// Update Count     : 528
    1414//
    1515
     
    169169          if ( cnt == 9 ) abort( "ofstream fmt EINTR spinning exceeded" );
    170170    } // for
    171         if ( len == EOF ) {
    172                 if ( ferror( (FILE *)(os.file$) ) ) {
    173                         abort | IO_MSG "invalid write";
    174                 } // if
     171        if ( len == EOF ) {                                                                     // error writing ?
     172                abort | IO_MSG "invalid write";
    175173        } // if
    176174        va_end( args );
     
    302300          if ( len != EOF || errno != EINTR ) break;            // timer interrupt ?
    303301    } // for
    304         if ( len == EOF ) {
    305                 if ( ferror( (FILE *)(is.file$) ) ) {
     302        if ( len == EOF ) {                                                                     // EOF or matching failure ?
     303                if ( ! feof( (FILE *)(is.file$) ) && ferror( (FILE *)(is.file$) ) ) {
    306304                        abort | IO_MSG "invalid read";
    307305                } // if
  • libcfa/src/iostream.hfa

    r0b0a285 rc84dd61  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 11:25:39 2023
    13 // Update Count     : 410
     12// Last Modified On : Thu Jun 15 22:34:31 2023
     13// Update Count     : 411
    1414//
    1515
     
    5151        int fmt( ostype &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
    5252}; // basic_ostream
    53        
     53
    5454forall( ostype & | basic_ostream( ostype ) )
    5555trait ostream {
     
    6868
    6969forall( T, ostype & | ostream( ostype ) )
    70         trait writeable {
     70trait writeable {
    7171        ostype & ?|?( ostype &, T );
    7272}; // writeable
     
    161161// *********************************** manipulators ***********************************
    162162
     163struct _Ostream_Flags {
     164        unsigned char eng:1;                                                            // engineering notation
     165        unsigned char neg:1;                                                            // val is negative
     166        unsigned char pc:1;                                                                     // precision specified
     167        unsigned char left:1;                                                           // left justify
     168        unsigned char nobsdp:1;                                                         // base prefix / decimal point
     169        unsigned char sign:1;                                                           // plus / minus sign
     170        unsigned char pad0:1;                                                           // zero pad
     171};
     172
    163173forall( T )
    164174struct _Ostream_Manip {
     
    168178        union {
    169179                unsigned char all;
    170                 struct {
    171                         unsigned char eng:1;                                            // engineering notation
    172                         unsigned char neg:1;                                            // val is negative
    173                         unsigned char pc:1;                                                     // precision specified
    174                         unsigned char left:1;                                           // left justify
    175                         unsigned char nobsdp:1;                                         // base prefix / decimal point
    176                         unsigned char sign:1;                                           // plus / minus sign
    177                         unsigned char pad0:1;                                           // zero pad
    178                 } flags;
     180                _Ostream_Flags flags;
    179181        };
    180182}; // _Ostream_Manip
  • libcfa/src/math.hfa

    r0b0a285 rc84dd61  
    1010// Created On       : Mon Apr 18 23:37:04 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct  8 08:40:42 2022
    13 // Update Count     : 136
     12// Last Modified On : Sun Jun 18 08:13:53 2023
     13// Update Count     : 202
    1414//
    1515
     
    236236
    237237        return (i << 32) + (sum);
    238 }
     238} // log2_u32_32
    239239
    240240//---------------------- Trigonometric ----------------------
     
    371371
    372372inline __attribute__((always_inline)) static {
    373         signed char floor( signed char n, signed char align ) { return n / align * align; }
    374         unsigned char floor( unsigned char n, unsigned char align ) { return n / align * align; }
    375         short int floor( short int n, short int align ) { return n / align * align; }
    376         unsigned short int floor( unsigned short int n, unsigned short int align ) { return n / align * align; }
    377         int floor( int n, int align ) { return n / align * align; }
    378         unsigned int floor( unsigned int n, unsigned int align ) { return n / align * align; }
    379         long int floor( long int n, long int align ) { return n / align * align; }
    380         unsigned long int floor( unsigned long int n, unsigned long int align ) { return n / align * align; }
    381         long long int floor( long long int n, long long int align ) { return n / align * align; }
    382         unsigned long long int floor( unsigned long long int n, unsigned long long int align ) { return n / align * align; }
     373        // force divide before multiply
     374        signed char floor( signed char n, signed char align ) { return (n / align) * align; }
     375        unsigned char floor( unsigned char n, unsigned char align ) { return (n / align) * align; }
     376        short int floor( short int n, short int align ) { return (n / align) * align; }
     377        unsigned short int floor( unsigned short int n, unsigned short int align ) { return (n / align) * align; }
     378        int floor( int n, int align ) { return (n / align) * align; }
     379        unsigned int floor( unsigned int n, unsigned int align ) { return (n / align) * align; }
     380        long int floor( long int n, long int align ) { return (n / align) * align; }
     381        unsigned long int floor( unsigned long int n, unsigned long int align ) { return (n / align) * align; }
     382        long long int floor( long long int n, long long int align ) { return (n / align) * align; }
     383        unsigned long long int floor( unsigned long long int n, unsigned long long int align ) { return (n / align) * align; }
    383384
    384385        // forall( T | { T ?/?( T, T ); T ?*?( T, T ); } )
    385         // T floor( T n, T align ) { return n / align * align; }
    386 
    387         signed char ceiling_div( signed char n, char align ) { return (n + (align - 1)) / align; }
    388         unsigned char ceiling_div( unsigned char n, unsigned char align ) { return (n + (align - 1)) / align; }
    389         short int ceiling_div( short int n, short int align ) { return (n + (align - 1)) / align; }
    390         unsigned short int ceiling_div( unsigned short int n, unsigned short int align ) { return (n + (align - 1)) / align; }
    391         int ceiling_div( int n, int align ) { return (n + (align - 1)) / align; }
    392         unsigned int ceiling_div( unsigned int n, unsigned int align ) { return (n + (align - 1)) / align; }
    393         long int ceiling_div( long int n, long int align ) { return (n + (align - 1)) / align; }
    394         unsigned long int ceiling_div( unsigned long int n, unsigned long int align ) { return (n + (align - 1)) / align; }
    395         long long int ceiling_div( long long int n, long long int align ) { return (n + (align - 1)) / align; }
    396         unsigned long long int ceiling_div( unsigned long long int n, unsigned long long int align ) { return (n + (align - 1)) / align; }
    397 
    398         // forall( T | { T ?+?( T, T ); T ?-?( T, T ); T ?%?( T, T ); } )
    399         // T ceiling_div( T n, T align ) { verify( is_pow2( align ) );return (n + (align - 1)) / align; }
    400 
    401         // gcc notices the div/mod pair and saves both so only one div.
    402         signed char ceiling( signed char n, signed char align ) { return floor( n + (n % align != 0 ? align - 1 : 0), align ); }
    403         unsigned char ceiling( unsigned char n, unsigned char align ) { return floor( n + (n % align != 0 ? align - 1 : 0), align ); }
    404         short int ceiling( short int n, short int align ) { return floor( n + (n % align != 0 ? align - 1 : 0), align ); }
    405         unsigned short int ceiling( unsigned short int n, unsigned short int align ) { return floor( n + (n % align != 0 ? align - 1 : 0), align ); }
    406         int ceiling( int n, int align ) { return floor( n + (n % align != 0 ? align - 1 : 0), align ); }
    407         unsigned int ceiling( unsigned int n, unsigned int align ) { return floor( n + (n % align != 0 ? align - 1 : 0), align ); }
    408         long int ceiling( long int n, long int align ) { return floor( n + (n % align != 0 ? align - 1 : 0), align ); }
    409         unsigned long int ceiling( unsigned long int n, unsigned long int align ) { return floor( n + (n % align != 0 ? align - 1 : 0) , align); }
    410         long long int ceiling( long long int n, long long int align ) { return floor( n + (n % align != 0 ? align - 1 : 0), align ); }
    411         unsigned long long int ceiling( unsigned long long int n, unsigned long long int align ) { return floor( n + (n % align != 0 ? align - 1 : 0), align ); }
    412 
    413         // forall( T | { void ?{}( T &, one_t ); T ?+?( T, T ); T ?-?( T, T ); T ?/?( T, T ); } )
    414         // T ceiling( T n, T align ) { return return floor( n + (n % align != 0 ? align - 1 : 0), align ); *}
     386        // T floor( T n, T align ) { return (n / align) * align; }
     387
     388        signed char ceiling_div( signed char n, char align ) { return (n + (align - 1hh)) / align; }
     389        unsigned char ceiling_div( unsigned char n, unsigned char align ) { return (n + (align - 1hhu)) / align; }
     390        short int ceiling_div( short int n, short int align ) { return (n + (align - 1h)) / align; }
     391        unsigned short int ceiling_div( unsigned short int n, unsigned short int align ) { return (n + (align - 1hu)) / align; }
     392        int ceiling_div( int n, int align ) { return (n + (align - 1n)) / align; }
     393        unsigned int ceiling_div( unsigned int n, unsigned int align ) { return (n + (align - 1nu)) / align; }
     394        long int ceiling_div( long int n, long int align ) { return (n + (align - 1l)) / align; }
     395        unsigned long int ceiling_div( unsigned long int n, unsigned long int align ) { return (n + (align - 1lu)) / align; }
     396        long long int ceiling_div( long long int n, long long int align ) { return (n + (align - 1ll)) / align; }
     397        unsigned long long int ceiling_div( unsigned long long int n, unsigned long long int align ) { return (n + (align - 1llu)) / align; }
     398
     399        signed char ceiling( signed char n, char align ) {
     400                typeof(n) trunc = floor( n, align );
     401                return n < 0 || n == trunc ? trunc : trunc + align;
     402        }
     403        unsigned char ceiling( unsigned char n, unsigned char align ) {
     404                typeof(n) trunc = floor( n, align );
     405                return n == trunc ? trunc : trunc + align;
     406        }
     407        short int ceiling( short int n, short int align ) {
     408                typeof(n) trunc = floor( n, align );
     409                return n < 0 || n == trunc ? trunc : trunc + align;
     410        }
     411        unsigned short int ceiling( unsigned short int n, unsigned short int align ) {
     412                typeof(n) trunc = floor( n, align );
     413                return n == trunc ? trunc : trunc + align;
     414        }
     415        int ceiling( int n, int align ) {
     416                typeof(n) trunc = floor( n, align );
     417                return n < 0 || n == trunc ? trunc : trunc + align;
     418        }
     419        unsigned int ceiling( unsigned int n, unsigned int align ) {
     420                typeof(n) trunc = floor( n, align );
     421                return n == trunc ? trunc : trunc + align;
     422        }
     423        long int ceiling( long int n, long int align ) {
     424                typeof(n) trunc = floor( n, align );
     425                return n < 0 || n == trunc ? trunc : trunc + align;
     426        }
     427        unsigned long int ceiling( unsigned long int n, unsigned long int align ) {
     428                typeof(n) trunc = floor( n, align );
     429                return n == trunc ? trunc : trunc + align;
     430        }
     431        long long int ceiling( long long int n, signed long long int align ) {
     432                typeof(n) trunc = floor( n, align );
     433                return n < 0 || n == trunc ? trunc : trunc + align;
     434        }
     435        unsigned long long int ceiling( unsigned long long int n, unsigned long long int align ) {
     436                typeof(n) trunc = floor( n, align );
     437                return n == trunc ? trunc : trunc + align;
     438        }
    415439
    416440        float floor( float x ) { return floorf( x ); }
  • libcfa/src/stdlib.hfa

    r0b0a285 rc84dd61  
    367367
    368368        char random( void ) { return (unsigned long int)random(); }
    369         char random( char u ) { return random( (unsigned long int)u ); } // [0,u)
     369        char random( char u ) { return (unsigned long int)random( (unsigned long int)u ); } // [0,u)
    370370        char random( char l, char u ) { return random( (unsigned long int)l, (unsigned long int)u ); } // [l,u)
    371371        int random( void ) { return (long int)random(); }
    372         int random( int u ) { return random( (long int)u ); } // [0,u]
     372        int random( int u ) { return (long int)random( (long int)u ); } // [0,u]
    373373        int random( int l, int u ) { return random( (long int)l, (long int)u ); } // [l,u)
    374374        unsigned int random( void ) { return (unsigned long int)random(); }
    375         unsigned int random( unsigned int u ) { return random( (unsigned long int)u ); } // [0,u]
     375        unsigned int random( unsigned int u ) { return (unsigned long int)random( (unsigned long int)u ); } // [0,u]
    376376        unsigned int random( unsigned int l, unsigned int u ) { return random( (unsigned long int)l, (unsigned long int)u ); } // [l,u)
    377377} // distribution
  • libcfa/src/virtual_dtor.hfa

    r0b0a285 rc84dd61  
    2525    __virtual_obj_start = &this;
    2626}
    27 static inline void __CFA_dtor_shutdown( virtual_dtor & this ) with(this) {
     27static inline bool __CFA_dtor_shutdown( virtual_dtor & this ) with(this) {
     28    if ( __virtual_dtor_ptr == 1p ) return true; // stop base dtors from being called twice
    2829    if ( __virtual_dtor_ptr ) {
    2930        void (*dtor_ptr)(virtual_dtor &) = __virtual_dtor_ptr;
    3031        __virtual_dtor_ptr = 0p;
    31         dtor_ptr(*((virtual_dtor *)__virtual_obj_start)); // replace actor with base type
    32         return;
     32        dtor_ptr(*((virtual_dtor *)__virtual_obj_start)); // call most derived dtor
     33        __virtual_dtor_ptr = 1p; // stop base dtors from being called twice
     34        return true;
    3335    }
     36    return false;
    3437}
    3538static inline void __CFA_virt_free( virtual_dtor & this ) { free( this.__virtual_obj_start ); }
  • src/AST/Convert.cpp

    r0b0a285 rc84dd61  
    23432343                                old->location,
    23442344                                GET_ACCEPT_1(arg, Expr),
    2345                                 old->isGenerated ? ast::GeneratedCast : ast::ExplicitCast
     2345                                old->isGenerated ? ast::GeneratedCast : ast::ExplicitCast,
     2346                                (ast::CastExpr::CastKind) old->kind
    23462347                        )
    23472348                );
  • src/AST/Expr.cpp

    r0b0a285 rc84dd61  
    186186// --- CastExpr
    187187
    188 CastExpr::CastExpr( const CodeLocation & loc, const Expr * a, GeneratedFlag g )
    189 : Expr( loc, new VoidType{} ), arg( a ), isGenerated( g ) {}
     188CastExpr::CastExpr( const CodeLocation & loc, const Expr * a, GeneratedFlag g, CastKind kind )
     189: Expr( loc, new VoidType{} ), arg( a ), isGenerated( g ), kind( kind ) {}
    190190
    191191bool CastExpr::get_lvalue() const {
  • src/AST/Expr.hpp

    r0b0a285 rc84dd61  
    5555                const Expr * e )
    5656        : decl( id ), declptr( declptr ), actualType( actual ), formalType( formal ), expr( e ) {}
     57
     58        operator bool() {return declptr;}
    5759};
    5860
     
    335337        GeneratedFlag isGenerated;
    336338
     339        enum CastKind {
     340                Default, // C
     341                Coerce, // reinterpret cast
     342                Return  // overload selection
     343        };
     344
     345        CastKind kind = Default;
     346
    337347        CastExpr( const CodeLocation & loc, const Expr * a, const Type * to,
    338                 GeneratedFlag g = GeneratedCast ) : Expr( loc, to ), arg( a ), isGenerated( g ) {}
     348                GeneratedFlag g = GeneratedCast, CastKind kind = Default ) : Expr( loc, to ), arg( a ), isGenerated( g ), kind( kind ) {}
    339349        /// Cast-to-void
    340         CastExpr( const CodeLocation & loc, const Expr * a, GeneratedFlag g = GeneratedCast );
     350        CastExpr( const CodeLocation & loc, const Expr * a, GeneratedFlag g = GeneratedCast, CastKind kind = Default );
    341351
    342352        /// Wrap a cast expression around an existing expression (always generated)
  • src/AST/SymbolTable.cpp

    r0b0a285 rc84dd61  
    1919
    2020#include "Copy.hpp"
     21#include <iostream>
     22#include <algorithm>
     23
    2124#include "Decl.hpp"
    2225#include "Expr.hpp"
     
    203206                        out.push_back(decl.second);
    204207                }
     208
     209                // std::cerr << otypeKey << ' ' << out.size() << std::endl;
    205210        }
    206211
  • src/AST/Type.hpp

    r0b0a285 rc84dd61  
    451451        bool operator==(const TypeEnvKey & other) const;
    452452        bool operator<(const TypeEnvKey & other) const;
    453 };
     453        operator bool() {return base;}
     454};
     455
    454456
    455457/// tuple type e.g. `[int, char]`
  • src/AST/TypeEnvironment.cpp

    r0b0a285 rc84dd61  
    135135                }
    136136        }
    137         sub.normalize();
     137        // sub.normalize();
    138138}
    139139
  • src/AST/TypeEnvironment.hpp

    r0b0a285 rc84dd61  
    6363
    6464                int cmp = d1->var->name.compare( d2->var->name );
    65                 return cmp < 0 || ( cmp == 0 && d1->result < d2->result );
     65                return cmp > 0 || ( cmp == 0 && d1->result < d2->result );
    6666        }
    6767};
  • src/Concurrency/Actors.cpp

    r0b0a285 rc84dd61  
    223223        if ( actorIter != actorStructDecls.end() && messageIter != messageStructDecls.end() ) {
    224224            //////////////////////////////////////////////////////////////////////
     225            // The following generates this wrapper for all receive(derived_actor &, derived_msg &) functions
     226            /* base_actor and base_msg are output params
     227            static inline allocation __CFA_receive_wrap( derived_actor & receiver, derived_msg & msg, actor ** base_actor, message ** base_msg ) {
     228                base_actor = &receiver;
     229                base_msg = &msg;
     230                return receive( receiver, msg );
     231            }
     232            */
     233            CompoundStmt * wrapBody = new CompoundStmt( decl->location );
     234
     235            // generates: base_actor = &receiver;
     236            wrapBody->push_back( new ExprStmt( decl->location,
     237                UntypedExpr::createAssign( decl->location,
     238                    UntypedExpr::createDeref( decl->location, new NameExpr( decl->location, "base_actor" ) ),
     239                    new AddressExpr( decl->location, new NameExpr( decl->location, "receiver" ) )
     240                )
     241            ));
     242
     243            // generates: base_msg = &msg;
     244            wrapBody->push_back( new ExprStmt( decl->location,
     245                UntypedExpr::createAssign( decl->location,
     246                    UntypedExpr::createDeref( decl->location, new NameExpr( decl->location, "base_msg" ) ),
     247                    new AddressExpr( decl->location, new NameExpr( decl->location, "msg" ) )
     248                )
     249            ));
     250
     251            // generates: return receive( receiver, msg );
     252            wrapBody->push_back( new ReturnStmt( decl->location,
     253                new UntypedExpr ( decl->location,
     254                    new NameExpr( decl->location, "receive" ),
     255                    {
     256                        new NameExpr( decl->location, "receiver" ),
     257                        new NameExpr( decl->location, "msg" )
     258                    }
     259                )
     260            ));
     261
     262            // create receive wrapper to extract base message and actor pointer
     263            // put it all together into the complete function decl from above
     264            FunctionDecl * receiveWrapper = new FunctionDecl(
     265                decl->location,
     266                "__CFA_receive_wrap",
     267                {},                     // forall
     268                {
     269                    new ObjectDecl(
     270                        decl->location,
     271                        "receiver",
     272                        ast::deepCopy( derivedActorRef )
     273                    ),
     274                    new ObjectDecl(
     275                        decl->location,
     276                        "msg",
     277                        ast::deepCopy( derivedMsgRef )
     278                    ),
     279                    new ObjectDecl(
     280                        decl->location,
     281                        "base_actor",
     282                        new PointerType( new PointerType( new StructInstType( *actorDecl ) ) )
     283                    ),
     284                    new ObjectDecl(
     285                        decl->location,
     286                        "base_msg",
     287                        new PointerType( new PointerType( new StructInstType( *msgDecl ) ) )
     288                    )
     289                },                      // params
     290                {
     291                    new ObjectDecl(
     292                        decl->location,
     293                        "__CFA_receive_wrap_ret",
     294                        new EnumInstType( *allocationDecl )
     295                    )
     296                },
     297                wrapBody,               // body
     298                { Storage::Static },    // storage
     299                Linkage::Cforall,       // linkage
     300                {},                     // attributes
     301                { Function::Inline }
     302            );
     303
     304            declsToAddAfter.push_back( receiveWrapper );
     305
     306            //////////////////////////////////////////////////////////////////////
    225307            // The following generates this send message operator routine for all receive(derived_actor &, derived_msg &) functions
    226308            /*
     
    246328            ));
    247329           
    248             // Function type is: allocation (*)( derived_actor &, derived_msg & )
     330            // Function type is: allocation (*)( derived_actor &, derived_msg &, actor **, message ** )
    249331            FunctionType * derivedReceive = new FunctionType();
    250332            derivedReceive->params.push_back( ast::deepCopy( derivedActorRef ) );
    251333            derivedReceive->params.push_back( ast::deepCopy( derivedMsgRef ) );
     334            derivedReceive->params.push_back( new PointerType( new PointerType( new StructInstType( *actorDecl ) ) ) );
     335            derivedReceive->params.push_back( new PointerType( new PointerType( new StructInstType( *msgDecl ) ) ) );
    252336            derivedReceive->returns.push_back( new EnumInstType( *allocationDecl ) );
    253337
    254             // Generates: allocation (*my_work_fn)( derived_actor &, derived_msg & ) = receive;
     338            // Generates: allocation (*my_work_fn)( derived_actor &, derived_msg &, actor **, message ** ) = receive;
    255339            sendBody->push_back( new DeclStmt(
    256340                decl->location,
     
    259343                    "my_work_fn",
    260344                    new PointerType( derivedReceive ),
    261                     new SingleInit( decl->location, new NameExpr( decl->location, "receive" ) )
     345                    new SingleInit( decl->location, new NameExpr( decl->location, "__CFA_receive_wrap" ) )
    262346                )
    263347            ));
     
    267351            genericReceive->params.push_back( new ReferenceType( new StructInstType( *actorDecl ) ) );
    268352            genericReceive->params.push_back( new ReferenceType( new StructInstType( *msgDecl ) ) );
     353            genericReceive->params.push_back( new PointerType( new PointerType( new StructInstType( *actorDecl ) ) ) );
     354            genericReceive->params.push_back( new PointerType( new PointerType( new StructInstType( *msgDecl ) ) ) );
    269355            genericReceive->returns.push_back( new EnumInstType( *allocationDecl ) );
    270356
     
    285371            ));
    286372
    287             // Generates: new_req{ &receiver, &msg, fn };
     373            // Generates: new_req{ (actor *)&receiver, (message *)&msg, fn };
    288374            sendBody->push_back( new ExprStmt(
    289375                decl->location,
     
    293379                                        {
    294380                                                new NameExpr( decl->location, "new_req" ),
    295                         new AddressExpr( new NameExpr( decl->location, "receiver" ) ),
    296                         new AddressExpr( new NameExpr( decl->location, "msg" ) ),
     381                        new CastExpr( decl->location, new AddressExpr( new NameExpr( decl->location, "receiver" ) ), new PointerType( new StructInstType( *actorDecl ) ), ExplicitCast ),
     382                        new CastExpr( decl->location, new AddressExpr( new NameExpr( decl->location, "msg" ) ), new PointerType( new StructInstType( *msgDecl ) ), ExplicitCast ),
    297383                        new NameExpr( decl->location, "fn" )
    298384                                        }
     
    321407            FunctionDecl * sendOperatorFunction = new FunctionDecl(
    322408                decl->location,
    323                 "?<<?",
     409                "?|?",
    324410                {},                     // forall
    325411                {
  • src/GenPoly/SpecializeNew.cpp

    r0b0a285 rc84dd61  
    113113        using namespace ResolvExpr;
    114114        ast::OpenVarSet openVars, closedVars;
    115         ast::AssertionSet need, have;
    116         findOpenVars( formalType, openVars, closedVars, need, have, FirstClosed );
    117         findOpenVars( actualType, openVars, closedVars, need, have, FirstOpen );
     115        ast::AssertionSet need, have; // unused
     116        ast::TypeEnvironment env; // unused
     117        // findOpenVars( formalType, openVars, closedVars, need, have, FirstClosed );
     118        findOpenVars( actualType, openVars, closedVars, need, have, env, FirstOpen );
    118119        for ( const ast::OpenVarSet::value_type & openVar : openVars ) {
    119120                const ast::Type * boundType = subs->lookup( openVar.first );
     
    125126                        if ( closedVars.find( *inst ) == closedVars.end() ) {
    126127                                return true;
     128                        }
     129                        else {
     130                                assertf(false, "closed: %s", inst->name.c_str());
    127131                        }
    128132                // Otherwise, the variable is bound to a concrete type.
  • src/Parser/DeclarationNode.cc

    r0b0a285 rc84dd61  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Apr 20 11:46:00 2023
    13 // Update Count     : 1393
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jun 17 14:41:48 2023
     13// Update Count     : 1405
    1414//
    1515
     
    459459        std::vector<ast::ptr<ast::Expr>> exprs;
    460460        buildList( expr, exprs );
    461         newnode->attributes.push_back(
    462                 new ast::Attribute( *name, std::move( exprs ) ) );
     461        newnode->attributes.push_back( new ast::Attribute( *name, std::move( exprs ) ) );
    463462        delete name;
    464463        return newnode;
     
    633632                                        dst->basictype = src->basictype;
    634633                                } else if ( src->basictype != DeclarationNode::NoBasicType )
    635                                         SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::basicTypeNames[ src->basictype ] + " in type: " );
     634                                        SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::basicTypeNames[ dst->basictype ] +
     635                                                                   "\" and \"" + DeclarationNode::basicTypeNames[ src->basictype ] + "\"." );
    636636
    637637                                if ( dst->complextype == DeclarationNode::NoComplexType ) {
    638638                                        dst->complextype = src->complextype;
    639639                                } else if ( src->complextype != DeclarationNode::NoComplexType )
    640                                         SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::complexTypeNames[ src->complextype ] + " in type: " );
     640                                        SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::complexTypeNames[ src->complextype ] +
     641                                                                   "\" and \"" + DeclarationNode::complexTypeNames[ src->complextype ] + "\"." );
    641642
    642643                                if ( dst->signedness == DeclarationNode::NoSignedness ) {
    643644                                        dst->signedness = src->signedness;
    644645                                } else if ( src->signedness != DeclarationNode::NoSignedness )
    645                                         SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::signednessNames[ src->signedness ] + " in type: " );
     646                                        SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::signednessNames[ dst->signedness ] +
     647                                                                   "\" and \"" + DeclarationNode::signednessNames[ src->signedness ] + "\"." );
    646648
    647649                                if ( dst->length == DeclarationNode::NoLength ) {
     
    650652                                        dst->length = DeclarationNode::LongLong;
    651653                                } else if ( src->length != DeclarationNode::NoLength )
    652                                         SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::lengthNames[ src->length ] + " in type: " );
     654                                        SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::lengthNames[ dst->length ] +
     655                                                                   "\" and \"" + DeclarationNode::lengthNames[ src->length ] + "\"." );
    653656                        } // if
    654657                        break;
     
    718721
    719722DeclarationNode * DeclarationNode::addEnumBase( DeclarationNode * o ) {
    720         if ( o && o -> type)  {
     723        if ( o && o->type)  {
    721724                type->base= o->type;
    722         }
     725        } // if
    723726        delete o;
    724727        return this;
     
    10031006}
    10041007
    1005 // If a typedef wraps an anonymous declaration, name the inner declaration
    1006 // so it has a consistent name across translation units.
     1008// If a typedef wraps an anonymous declaration, name the inner declaration so it has a consistent name across
     1009// translation units.
    10071010static void nameTypedefedDecl(
    10081011                DeclarationNode * innerDecl,
     
    10851088}
    10861089
    1087 void buildList( DeclarationNode * firstNode,
    1088                 std::vector<ast::ptr<ast::Decl>> & outputList ) {
     1090void buildList( DeclarationNode * firstNode, std::vector<ast::ptr<ast::Decl>> & outputList ) {
    10891091        SemanticErrorException errors;
    10901092        std::back_insert_iterator<std::vector<ast::ptr<ast::Decl>>> out( outputList );
  • src/Parser/ExpressionNode.cc

    r0b0a285 rc84dd61  
    601601ast::Expr * build_cast( const CodeLocation & location,
    602602                DeclarationNode * decl_node,
    603                 ExpressionNode * expr_node ) {
     603                ExpressionNode * expr_node,
     604                ast::CastExpr::CastKind kind ) {
    604605        ast::Type * targetType = maybeMoveBuildType( decl_node );
    605606        if ( dynamic_cast<ast::VoidType *>( targetType ) ) {
     
    607608                return new ast::CastExpr( location,
    608609                        maybeMoveBuild( expr_node ),
    609                         ast::ExplicitCast );
     610                        ast::ExplicitCast, kind );
    610611        } else {
    611612                return new ast::CastExpr( location,
    612613                        maybeMoveBuild( expr_node ),
    613614                        targetType,
    614                         ast::ExplicitCast );
     615                        ast::ExplicitCast, kind );
    615616        } // if
    616617} // build_cast
  • src/Parser/ExpressionNode.h

    r0b0a285 rc84dd61  
    6969ast::DimensionExpr * build_dimensionref( const CodeLocation &, const std::string * name );
    7070
    71 ast::Expr * build_cast( const CodeLocation &, DeclarationNode * decl_node, ExpressionNode * expr_node );
     71ast::Expr * build_cast( const CodeLocation &, DeclarationNode * decl_node, ExpressionNode * expr_node, ast::CastExpr::CastKind kind = ast::CastExpr::Default );
    7272ast::Expr * build_keyword_cast( const CodeLocation &, ast::AggregateDecl::Aggregate target, ExpressionNode * expr_node );
    7373ast::Expr * build_virtual_cast( const CodeLocation &, DeclarationNode * decl_node, ExpressionNode * expr_node );
  • src/Parser/parser.yy

    r0b0a285 rc84dd61  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun  7 14:32:28 2023
    13 // Update Count     : 6341
     12// Last Modified On : Sat Jun 17 18:53:24 2023
     13// Update Count     : 6347
    1414//
    1515
     
    931931                { $$ = new ExpressionNode( new ast::VirtualCastExpr( yylloc, maybeMoveBuild( $5 ), maybeMoveBuildType( $3 ) ) ); }
    932932        | '(' RETURN type_no_function ')' cast_expression       // CFA
    933                 { SemanticError( yylloc, "Return cast is currently unimplemented." ); $$ = nullptr; }
     933                { $$ = new ExpressionNode( build_cast( yylloc, $3, $5, ast::CastExpr::Return ) ); }
    934934        | '(' COERCE type_no_function ')' cast_expression       // CFA
    935935                { SemanticError( yylloc, "Coerce cast is currently unimplemented." ); $$ = nullptr; }
     
    10401040                // FIX ME: computes $1 twice
    10411041        | logical_OR_expression '?' /* empty */ ':' conditional_expression // GCC, omitted first operand
    1042                 { $$ = new ExpressionNode( build_cond( yylloc, $1, $1, $4 ) ); }
     1042                { $$ = new ExpressionNode( build_cond( yylloc, $1, $1->clone(), $4 ) ); }
    10431043        ;
    10441044
  • src/ResolvExpr/Candidate.hpp

    r0b0a285 rc84dd61  
    9191
    9292/// Holdover behaviour from old `findMinCost` -- xxx -- can maybe be eliminated?
     93/*
    9394static inline void promoteCvtCost( CandidateList & candidates ) {
    9495        for ( CandidateRef & r : candidates ) {
     
    9697        }
    9798}
     99*/
    98100
    99101void print( std::ostream & os, const Candidate & cand, Indenter indent = {} );
  • src/ResolvExpr/CandidateFinder.cpp

    r0b0a285 rc84dd61  
    3838#include "typeops.h"              // for combos
    3939#include "Unify.h"
     40#include "WidenMode.h"
    4041#include "AST/Expr.hpp"
    4142#include "AST/Node.hpp"
     
    749750                        // attempt to narrow based on expected target type
    750751                        const ast::Type * returnType = funcType->returns.front();
    751                         if ( ! unify(
    752                                 returnType, targetType, funcEnv, funcNeed, funcHave, funcOpen )
    753                         ) {
    754                                 // unification failed, do not pursue this candidate
    755                                 return;
     752                        if ( selfFinder.strictMode ) {
     753                                if ( ! unifyExact(
     754                                        returnType, targetType, funcEnv, funcNeed, funcHave, funcOpen, noWiden() ) // xxx - is no widening correct?
     755                                ) {
     756                                        // unification failed, do not pursue this candidate
     757                                        return;
     758                                }
     759                        }
     760                        else {
     761                                if ( ! unify(
     762                                        returnType, targetType, funcEnv, funcNeed, funcHave, funcOpen )
     763                                ) {
     764                                        // unification failed, do not pursue this candidate
     765                                        return;
     766                                }
    756767                        }
    757768                }
     
    771782                                for (size_t i=0; i<nParams; ++i) {
    772783                                        auto obj = funcDecl->params[i].strict_as<ast::ObjectDecl>();
    773                                         if (!instantiateArgument( location,
     784                                        if ( !instantiateArgument( location,
    774785                                                funcType->params[i], obj->init, args, results, genStart, symtab)) return;
    775786                                }
     
    781792                        // matches
    782793                        // no default args for indirect calls
    783                         if ( ! instantiateArgument( location,
     794                        if ( !instantiateArgument( location,
    784795                                param, nullptr, args, results, genStart, symtab ) ) return;
    785796                }
     
    874885
    875886                if ( auto structInst = aggrExpr->result.as< ast::StructInstType >() ) {
    876                         addAggMembers( structInst, aggrExpr, *cand, Cost::safe, "" );
     887                        addAggMembers( structInst, aggrExpr, *cand, Cost::unsafe, "" );
    877888                } else if ( auto unionInst = aggrExpr->result.as< ast::UnionInstType >() ) {
    878                         addAggMembers( unionInst, aggrExpr, *cand, Cost::safe, "" );
     889                        addAggMembers( unionInst, aggrExpr, *cand, Cost::unsafe, "" );
    879890                }
    880891        }
     
    10071018                                if ( auto pointer = dynamic_cast< const ast::PointerType * >( funcResult ) ) {
    10081019                                        if ( auto function = pointer->base.as< ast::FunctionType >() ) {
     1020                                                // if (!selfFinder.allowVoid && function->returns.empty()) continue;
    10091021                                                CandidateRef newFunc{ new Candidate{ *func } };
    10101022                                                newFunc->expr =
     
    10181030                                        if ( const ast::EqvClass * clz = func->env.lookup( *inst ) ) {
    10191031                                                if ( auto function = clz->bound.as< ast::FunctionType >() ) {
    1020                                                         CandidateRef newFunc{ new Candidate{ *func } };
     1032                                                        CandidateRef newFunc( new Candidate( *func ) );
    10211033                                                        newFunc->expr =
    10221034                                                                referenceToRvalueConversion( newFunc->expr, newFunc->cost );
     
    10601072                if ( found.empty() && ! errors.isEmpty() ) { throw errors; }
    10611073
     1074                // only keep the best matching intrinsic result to match C semantics (no unexpected narrowing/widening)
     1075                // TODO: keep one for each set of argument candidates?
     1076                Cost intrinsicCost = Cost::infinity;
     1077                CandidateList intrinsicResult;
     1078
    10621079                // Compute conversion costs
    10631080                for ( CandidateRef & withFunc : found ) {
     
    10821099                        if ( cvtCost != Cost::infinity ) {
    10831100                                withFunc->cvtCost = cvtCost;
    1084                                 candidates.emplace_back( std::move( withFunc ) );
    1085                         }
    1086                 }
     1101                                withFunc->cost += cvtCost;
     1102                                auto func = withFunc->expr.strict_as<ast::ApplicationExpr>()->func.as<ast::VariableExpr>();
     1103                                if (func && func->var->linkage == ast::Linkage::Intrinsic) {
     1104                                        if (withFunc->cost < intrinsicCost) {
     1105                                                intrinsicResult.clear();
     1106                                                intrinsicCost = withFunc->cost;
     1107                                        }
     1108                                        if (withFunc->cost == intrinsicCost) {
     1109                                                intrinsicResult.emplace_back(std::move(withFunc));
     1110                                        }
     1111                                }
     1112                                else {
     1113                                        candidates.emplace_back( std::move( withFunc ) );
     1114                                }
     1115                        }
     1116                }
     1117                spliceBegin( candidates, intrinsicResult );
    10871118                found = std::move( candidates );
    10881119
    10891120                // use a new list so that candidates are not examined by addAnonConversions twice
    1090                 CandidateList winners = findMinCost( found );
    1091                 promoteCvtCost( winners );
     1121                // CandidateList winners = findMinCost( found );
     1122                // promoteCvtCost( winners );
    10921123
    10931124                // function may return a struct/union value, in which case we need to add candidates
    10941125                // for implicit conversions to each of the anonymous members, which must happen after
    10951126                // `findMinCost`, since anon conversions are never the cheapest
    1096                 for ( const CandidateRef & c : winners ) {
     1127                for ( const CandidateRef & c : found ) {
    10971128                        addAnonConversions( c );
    10981129                }
    1099                 spliceBegin( candidates, winners );
    1100 
    1101                 if ( candidates.empty() && targetType && ! targetType->isVoid() ) {
     1130                // would this be too slow when we don't check cost anymore?
     1131                spliceBegin( candidates, found );
     1132
     1133                if ( candidates.empty() && targetType && ! targetType->isVoid() && !selfFinder.strictMode ) {
    11021134                        // If resolution is unsuccessful with a target type, try again without, since it
    11031135                        // will sometimes succeed when it wouldn't with a target type binding.
     
    11401172
    11411173                CandidateFinder finder( context, tenv, toType );
     1174                if (toType->isVoid()) {
     1175                        finder.allowVoid = true;
     1176                }
     1177                if ( castExpr->kind == ast::CastExpr::Return ) {
     1178                        finder.strictMode = true;
     1179                        finder.find( castExpr->arg, ResolvMode::withAdjustment() );
     1180
     1181                        // return casts are eliminated (merely selecting an overload, no actual operation)
     1182                        candidates = std::move(finder.candidates);
     1183                }
    11421184                finder.find( castExpr->arg, ResolvMode::withAdjustment() );
    11431185
     
    11451187
    11461188                CandidateList matches;
     1189                Cost minExprCost = Cost::infinity;
     1190                Cost minCastCost = Cost::infinity;
    11471191                for ( CandidateRef & cand : finder.candidates ) {
    11481192                        ast::AssertionSet need( cand->need.begin(), cand->need.end() ), have;
     
    11761220                                // count one safe conversion for each value that is thrown away
    11771221                                thisCost.incSafe( discardedValues );
    1178                                 CandidateRef newCand = std::make_shared<Candidate>(
    1179                                         restructureCast( cand->expr, toType, castExpr->isGenerated ),
    1180                                         copy( cand->env ), std::move( open ), std::move( need ), cand->cost,
    1181                                         cand->cost + thisCost );
    1182                                 inferParameters( newCand, matches );
    1183                         }
    1184                 }
    1185 
    1186                 // select first on argument cost, then conversion cost
    1187                 CandidateList minArgCost = findMinCost( matches );
    1188                 promoteCvtCost( minArgCost );
    1189                 candidates = findMinCost( minArgCost );
     1222                                // select first on argument cost, then conversion cost
     1223                                if ( cand->cost < minExprCost || ( cand->cost == minExprCost && thisCost < minCastCost ) ) {
     1224                                        minExprCost = cand->cost;
     1225                                        minCastCost = thisCost;
     1226                                        matches.clear();
     1227
     1228
     1229                                }
     1230                                // ambiguous case, still output candidates to print in error message
     1231                                if ( cand->cost == minExprCost && thisCost == minCastCost ) {
     1232                                        CandidateRef newCand = std::make_shared<Candidate>(
     1233                                                restructureCast( cand->expr, toType, castExpr->isGenerated ),
     1234                                                copy( cand->env ), std::move( open ), std::move( need ), cand->cost + thisCost);
     1235                                        // currently assertions are always resolved immediately so this should have no effect.
     1236                                        // if this somehow changes in the future (e.g. delayed by indeterminate return type)
     1237                                        // we may need to revisit the logic.
     1238                                        inferParameters( newCand, matches );
     1239                                }
     1240                                // else skip, better alternatives found
     1241
     1242                        }
     1243                }
     1244                candidates = std::move(matches);
     1245
     1246                //CandidateList minArgCost = findMinCost( matches );
     1247                //promoteCvtCost( minArgCost );
     1248                //candidates = findMinCost( minArgCost );
    11901249        }
    11911250
     
    14531512                // candidates for true result
    14541513                CandidateFinder finder2( context, tenv );
     1514                finder2.allowVoid = true;
    14551515                finder2.find( conditionalExpr->arg2, ResolvMode::withAdjustment() );
    14561516                if ( finder2.candidates.empty() ) return;
     
    14581518                // candidates for false result
    14591519                CandidateFinder finder3( context, tenv );
     1520                finder3.allowVoid = true;
    14601521                finder3.find( conditionalExpr->arg3, ResolvMode::withAdjustment() );
    14611522                if ( finder3.candidates.empty() ) return;
     
    15241585        void Finder::postvisit( const ast::ConstructorExpr * ctorExpr ) {
    15251586                CandidateFinder finder( context, tenv );
     1587                finder.allowVoid = true;
    15261588                finder.find( ctorExpr->callExpr, ResolvMode::withoutPrune() );
    15271589                for ( CandidateRef & r : finder.candidates ) {
     
    16401702                        CandidateFinder finder( context, tenv, toType );
    16411703                        finder.find( initExpr->expr, ResolvMode::withAdjustment() );
     1704
     1705                        Cost minExprCost = Cost::infinity;
     1706                        Cost minCastCost = Cost::infinity;
    16421707                        for ( CandidateRef & cand : finder.candidates ) {
    16431708                                if (reason.code == NotFound) reason.code = NoMatch;
     
    16771742                                        // count one safe conversion for each value that is thrown away
    16781743                                        thisCost.incSafe( discardedValues );
    1679                                         CandidateRef newCand = std::make_shared<Candidate>(
    1680                                                 new ast::InitExpr{
    1681                                                         initExpr->location, restructureCast( cand->expr, toType ),
    1682                                                         initAlt.designation },
    1683                                                 std::move(env), std::move( open ), std::move( need ), cand->cost, thisCost );
    1684                                         inferParameters( newCand, matches );
     1744                                        if ( cand->cost < minExprCost || ( cand->cost == minExprCost && thisCost < minCastCost ) ) {
     1745                                                minExprCost = cand->cost;
     1746                                                minCastCost = thisCost;
     1747                                                matches.clear();
     1748                                        }
     1749                                        // ambiguous case, still output candidates to print in error message
     1750                                        if ( cand->cost == minExprCost && thisCost == minCastCost ) {
     1751                                                CandidateRef newCand = std::make_shared<Candidate>(
     1752                                                        new ast::InitExpr{
     1753                                                                initExpr->location,
     1754                                                                restructureCast( cand->expr, toType ),
     1755                                                                initAlt.designation },
     1756                                                        std::move(env), std::move( open ), std::move( need ), cand->cost + thisCost );
     1757                                                // currently assertions are always resolved immediately so this should have no effect.
     1758                                                // if this somehow changes in the future (e.g. delayed by indeterminate return type)
     1759                                                // we may need to revisit the logic.
     1760                                                inferParameters( newCand, matches );
     1761                                        }
    16851762                                }
    16861763                        }
     
    16881765
    16891766                // select first on argument cost, then conversion cost
    1690                 CandidateList minArgCost = findMinCost( matches );
    1691                 promoteCvtCost( minArgCost );
    1692                 candidates = findMinCost( minArgCost );
     1767                // CandidateList minArgCost = findMinCost( matches );
     1768                // promoteCvtCost( minArgCost );
     1769                // candidates = findMinCost( minArgCost );
     1770                candidates = std::move(matches);
    16931771        }
    16941772
     
    17561834                        auto found = selected.find( mangleName );
    17571835                        if ( found != selected.end() ) {
    1758                                 if ( newCand->cost < found->second.candidate->cost ) {
     1836                                // tiebreaking by picking the lower cost on CURRENT expression
     1837                                // NOTE: this behavior is different from C semantics.
     1838                                // Specific remediations are performed for C operators at postvisit(UntypedExpr).
     1839                                // Further investigations may take place.
     1840                                if ( newCand->cost < found->second.candidate->cost
     1841                                        || (newCand->cost == found->second.candidate->cost && newCand->cvtCost < found->second.candidate->cvtCost) ) {
    17591842                                        PRINT(
    17601843                                                std::cerr << "cost " << newCand->cost << " beats "
     
    17631846
    17641847                                        found->second = PruneStruct{ newCand };
    1765                                 } else if ( newCand->cost == found->second.candidate->cost ) {
     1848                                } else if ( newCand->cost == found->second.candidate->cost && newCand->cvtCost == found->second.candidate->cvtCost ) {
    17661849                                        // if one of the candidates contains a deleted identifier, can pick the other,
    17671850                                        // since deleted expressions should not be ambiguous if there is another option
     
    18541937        */
    18551938
    1856         if ( mode.prune ) {
     1939        // optimization: don't prune for NameExpr since it never has cost
     1940        if ( mode.prune && !dynamic_cast<const ast::NameExpr *>(expr) ) {
    18571941                // trim candidates to single best one
    18581942                PRINT(
  • src/ResolvExpr/CandidateFinder.hpp

    r0b0a285 rc84dd61  
    3333        const ast::TypeEnvironment & env;  ///< Substitutions performed in this resolution
    3434        ast::ptr< ast::Type > targetType;  ///< Target type for resolution
     35        bool strictMode = false;           ///< If set to true, requires targetType to be exact match (inside return cast)
     36        bool allowVoid = false;            ///< If set to true, allow void-returning function calls (only top level, cast to void and first in comma)
    3537        std::set< std::string > otypeKeys;  /// different type may map to same key
    3638
  • src/ResolvExpr/CastCost.cc

    r0b0a285 rc84dd61  
    234234        if ( typesCompatibleIgnoreQualifiers( src, dst, env ) ) {
    235235                PRINT( std::cerr << "compatible!" << std::endl; )
     236                if (dynamic_cast<const ast::ZeroType *>(dst) || dynamic_cast<const ast::OneType *>(dst)) {
     237                        return Cost::spec;
     238                }
    236239                return Cost::zero;
    237240        } else if ( dynamic_cast< const ast::VoidType * >( dst ) ) {
  • src/ResolvExpr/CommonType.cc

    r0b0a285 rc84dd61  
    697697                        if ( auto basic2 = dynamic_cast< const ast::BasicType * >( type2 ) ) {
    698698                                #warning remove casts when `commonTypes` moved to new AST
     699                               
     700                                /*
    699701                                ast::BasicType::Kind kind = (ast::BasicType::Kind)(int)commonTypes[ (BasicType::Kind)(int)basic->kind ][ (BasicType::Kind)(int)basic2->kind ];
    700702                                if (
     
    706708                                        result = new ast::BasicType{ kind, basic->qualifiers | basic2->qualifiers };
    707709                                }
     710                                */
     711                                ast::BasicType::Kind kind;
     712                                if (basic->kind != basic2->kind && !widen.first && !widen.second) return;
     713                                else if (!widen.first) kind = basic->kind; // widen.second
     714                                else if (!widen.second) kind = basic2->kind;
     715                                else kind = (ast::BasicType::Kind)(int)commonTypes[ (BasicType::Kind)(int)basic->kind ][ (BasicType::Kind)(int)basic2->kind ];
     716                                // xxx - what does qualifiers even do here??
     717                                if ( (basic->qualifiers >= basic2->qualifiers || widen.first)
     718                                        && (basic->qualifiers <= basic2->qualifiers || widen.second) ) {
     719                                        result = new ast::BasicType{ kind, basic->qualifiers | basic2->qualifiers };
     720                                }
     721                               
    708722                        } else if (
    709723                                dynamic_cast< const ast::ZeroType * >( type2 )
     
    712726                                #warning remove casts when `commonTypes` moved to new AST
    713727                                ast::BasicType::Kind kind = (ast::BasicType::Kind)(int)commonTypes[ (BasicType::Kind)(int)basic->kind ][ (BasicType::Kind)(int)ast::BasicType::SignedInt ];
    714                                 if (
    715                                         ( ( kind == basic->kind && basic->qualifiers >= type2->qualifiers )
     728                                /*
     729                                if ( // xxx - what does qualifier even do here??
     730                                        ( ( basic->qualifiers >= type2->qualifiers )
    716731                                                || widen.first )
    717                                         && ( ( kind != basic->kind && basic->qualifiers <= type2->qualifiers )
     732                                         && ( ( /* kind != basic->kind && basic->qualifiers <= type2->qualifiers )
    718733                                                || widen.second )
    719                                 ) {
    720                                         result = new ast::BasicType{ kind, basic->qualifiers | type2->qualifiers };
     734                                )
     735                                */
     736                                if (widen.second) {
     737                                        result = new ast::BasicType{ basic->kind, basic->qualifiers | type2->qualifiers };
    721738                                }
    722739                        } else if ( const ast::EnumInstType * enumInst = dynamic_cast< const ast::EnumInstType * >( type2 ) ) {
     
    746763                                auto entry = open.find( *var );
    747764                                if ( entry != open.end() ) {
     765                                // if (tenv.lookup(*var)) {
    748766                                        ast::AssertionSet need, have;
    749767                                        if ( ! tenv.bindVar(
  • src/ResolvExpr/ConversionCost.cc

    r0b0a285 rc84dd61  
    702702
    703703        cost = costCalc( refType->base, dst, srcIsLvalue, symtab, env );
     704
     705        // xxx - should qualifiers be considered in pass-by-value?
     706        /*
    704707        if ( refType->base->qualifiers == dst->qualifiers ) {
    705708                cost.incReference();
     
    709712                cost.incUnsafe();
    710713        }
     714        */
     715        cost.incReference();
    711716}
    712717
     
    792797                        cost.incSign( signMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ] );
    793798                }
     799                // this has the effect of letting any expr such as x+0, x+1 to be typed
     800                // the same as x, instead of at least int. are we willing to sacrifice this little
     801                // bit of coherence with C?
     802                // TODO: currently this does not work when no zero/one overloads exist. Find a fix for it.
     803                // cost = Cost::zero;
    794804        } else if ( dynamic_cast< const ast::PointerType * >( dst ) ) {
    795805                cost = Cost::zero;
    796806                // +1 for zero_t ->, +1 for disambiguation
    797807                cost.incSafe( maxIntCost + 2 );
     808                // assuming 0p is supposed to be used for pointers?
    798809        }
    799810}
     
    804815                cost = Cost::zero;
    805816        } else if ( const ast::BasicType * dstAsBasic =
    806                         dynamic_cast< const ast::BasicType * >( dst ) ) {
     817                        dynamic_cast< const ast::BasicType * >( dst ) ) {               
    807818                int tableResult = costMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ];
    808819                if ( -1 == tableResult ) {
     
    813824                        cost.incSign( signMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ] );
    814825                }
     826               
     827                // cost = Cost::zero;
    815828        }
    816829}
  • src/ResolvExpr/FindOpenVars.cc

    r0b0a285 rc84dd61  
    2121#include "AST/Pass.hpp"
    2222#include "AST/Type.hpp"
     23#include "AST/TypeEnvironment.hpp"
    2324#include "Common/PassVisitor.h"
    2425#include "SynTree/Declaration.h"  // for TypeDecl, DeclarationWithType (ptr ...
    2526#include "SynTree/Type.h"         // for Type, Type::ForallList, ArrayType
     27
     28#include <iostream>
    2629
    2730namespace ResolvExpr {
     
    102105                        ast::AssertionSet & need;
    103106                        ast::AssertionSet & have;
     107                        ast::TypeEnvironment & env;
    104108                        bool nextIsOpen;
    105109
    106110                        FindOpenVars_new(
    107111                                ast::OpenVarSet & o, ast::OpenVarSet & c, ast::AssertionSet & n,
    108                                 ast::AssertionSet & h, FirstMode firstIsOpen )
    109                         : open( o ), closed( c ), need( n ), have( h ), nextIsOpen( firstIsOpen ) {}
     112                                ast::AssertionSet & h, ast::TypeEnvironment & env, FirstMode firstIsOpen )
     113                        : open( o ), closed( c ), need( n ), have( h ), env (env), nextIsOpen( firstIsOpen ) {}
    110114
    111115                        void previsit( const ast::FunctionType * type ) {
    112116                                // mark open/closed variables
    113117                                if ( nextIsOpen ) {
     118                                        // trying to remove this from resolver.
     119                                        // occasionally used in other parts so not deleting right now.
     120
     121                                        // insert open variables unbound to environment.
     122                                        env.add(type->forall);
     123
    114124                                        for ( auto & decl : type->forall ) {
    115125                                                open[ *decl ] = ast::TypeData{ decl->base };
     
    137147        void findOpenVars(
    138148                        const ast::Type * type, ast::OpenVarSet & open, ast::OpenVarSet & closed,
    139                         ast::AssertionSet & need, ast::AssertionSet & have, FirstMode firstIsOpen ) {
    140                 ast::Pass< FindOpenVars_new > finder{ open, closed, need, have, firstIsOpen };
     149                        ast::AssertionSet & need, ast::AssertionSet & have, ast::TypeEnvironment & env, FirstMode firstIsOpen ) {
     150                ast::Pass< FindOpenVars_new > finder{ open, closed, need, have, env, firstIsOpen };
    141151                type->accept( finder );
     152
     153                if (!closed.empty()) {
     154                        std::cerr << "closed: ";
     155                        for (auto& i : closed) {
     156                                std::cerr << i.first.base->location << ":" << i.first.base->name << ' ';
     157                        }
     158                        std::cerr << std::endl;
     159                }
    142160        }
    143161} // namespace ResolvExpr
  • src/ResolvExpr/FindOpenVars.h

    r0b0a285 rc84dd61  
    3333        void findOpenVars(
    3434                const ast::Type * type, ast::OpenVarSet & open, ast::OpenVarSet & closed,
    35                 ast::AssertionSet & need, ast::AssertionSet & have, FirstMode firstIsOpen );
     35                ast::AssertionSet & need, ast::AssertionSet & have, ast::TypeEnvironment & env, FirstMode firstIsOpen );
    3636} // namespace ResolvExpr
    3737
  • src/ResolvExpr/Resolver.cc

    r0b0a285 rc84dd61  
    10111011                        ast::TypeEnvironment env;
    10121012                        CandidateFinder finder( context, env );
     1013                        finder.allowVoid = true;
    10131014                        finder.find( untyped, recursion_level == 1 ? mode.atTopLevel() : mode );
    10141015                        --recursion_level;
     
    10541055
    10551056                        // promote candidate.cvtCost to .cost
    1056                         promoteCvtCost( winners );
     1057                        // promoteCvtCost( winners );
    10571058
    10581059                        // produce ambiguous errors, if applicable
  • src/ResolvExpr/SatisfyAssertions.cpp

    r0b0a285 rc84dd61  
    1616#include "SatisfyAssertions.hpp"
    1717
     18#include <iostream>
    1819#include <algorithm>
    1920#include <cassert>
     
    4546#include "SymTab/Mangler.h"
    4647
     48
     49
    4750namespace ResolvExpr {
    4851
     
    6568                        ast::AssertionSet && h, ast::AssertionSet && n, ast::OpenVarSet && o, ast::UniqueId rs )
    6669                : cdata( c ), adjType( at ), env( std::move( e ) ), have( std::move( h ) ),
    67                   need( std::move( n ) ), open( std::move( o ) ), resnSlot( rs ) {}
     70                  need( std::move( n ) ), open( std::move( o ) ), resnSlot( rs ) {
     71                        if (!have.empty()) {
     72                                // std::cerr << c.id->location << ':' << c.id->name << std::endl; // I think this was debugging code so I commented it
     73                        }
     74                  }
    6875        };
    6976
     
    139146        };
    140147
    141         /// Adds a captured assertion to the symbol table
    142         void addToSymbolTable( const ast::AssertionSet & have, ast::SymbolTable & symtab ) {
    143                 for ( auto & i : have ) {
    144                         if ( i.second.isUsed ) { symtab.addId( i.first->var ); }
    145                 }
    146         }
     148        enum AssertionResult {Fail, Skip, Success} ;
    147149
    148150        /// Binds a single assertion, updating satisfaction state
     
    155157                        "Assertion candidate does not have a unique ID: %s", toString( candidate ).c_str() );
    156158
    157                 ast::Expr * varExpr = match.cdata.combine( cand->expr->location, cand->cvtCost );
     159                ast::Expr * varExpr = match.cdata.combine( cand->expr->location, cand->cost );
    158160                varExpr->result = match.adjType;
    159161                if ( match.resnSlot ) { varExpr->inferred.resnSlots().emplace_back( match.resnSlot ); }
     
    165167
    166168        /// Satisfy a single assertion
    167         bool satisfyAssertion( ast::AssertionList::value_type & assn, SatState & sat, bool allowConversion = false, bool skipUnbound = false) {
     169        AssertionResult satisfyAssertion( ast::AssertionList::value_type & assn, SatState & sat, bool skipUnbound = false) {
    168170                // skip unused assertions
    169                 if ( ! assn.second.isUsed ) return true;
     171                // static unsigned int cnt = 0; // I think this was debugging code so I commented it
     172                if ( ! assn.second.isUsed ) return AssertionResult::Success;
     173
     174                // if (assn.first->var->name[1] == '|') std::cerr << ++cnt << std::endl; // I think this was debugging code so I commented it
    170175
    171176                // find candidates that unify with the desired type
    172                 AssnCandidateList matches;
     177                AssnCandidateList matches, inexactMatches;
    173178
    174179                std::vector<ast::SymbolTable::IdData> candidates;
     
    179184                                .strict_as<ast::FunctionType>()->params[0]
    180185                                .strict_as<ast::ReferenceType>()->base;
    181                         sat.cand->env.apply(thisArgType);
     186                        // sat.cand->env.apply(thisArgType);
     187
     188                        if (auto inst = thisArgType.as<ast::TypeInstType>()) {
     189                                auto cls = sat.cand->env.lookup(*inst);
     190                                if (cls && cls->bound) thisArgType = cls->bound;
     191                        }
    182192
    183193                        std::string otypeKey = "";
    184194                        if (thisArgType.as<ast::PointerType>()) otypeKey = Mangle::Encoding::pointer;
    185195                        else if (!isUnboundType(thisArgType)) otypeKey = Mangle::mangle(thisArgType, Mangle::Type | Mangle::NoGenericParams);
    186                         else if (skipUnbound) return false;
     196                        else if (skipUnbound) return AssertionResult::Skip;
    187197
    188198                        candidates = sat.symtab.specialLookupId(kind, otypeKey);
     
    212222
    213223                        ast::OpenVarSet closed;
    214                         findOpenVars( toType, newOpen, closed, newNeed, have, FirstClosed );
    215                         findOpenVars( adjType, newOpen, closed, newNeed, have, FirstOpen );
    216                         if ( allowConversion ) {
     224                        // findOpenVars( toType, newOpen, closed, newNeed, have, FirstClosed );
     225                        findOpenVars( adjType, newOpen, closed, newNeed, have, newEnv, FirstOpen );
     226                        ast::TypeEnvironment tempNewEnv {newEnv};
     227
     228                        if ( unifyExact( toType, adjType, tempNewEnv, newNeed, have, newOpen, WidenMode {true, true} ) ) {
     229                                // set up binding slot for recursive assertions
     230                                ast::UniqueId crntResnSlot = 0;
     231                                if ( ! newNeed.empty() ) {
     232                                        crntResnSlot = ++globalResnSlot;
     233                                        for ( auto & a : newNeed ) { a.second.resnSlot = crntResnSlot; }
     234                                }
     235
     236                                matches.emplace_back(
     237                                        cdata, adjType, std::move( tempNewEnv ), std::move( have ), std::move( newNeed ),
     238                                        std::move( newOpen ), crntResnSlot );
     239                        }
     240                        else if ( matches.empty() ) {
     241                                // restore invalidated env
     242                                // newEnv = sat.cand->env;
     243                                // newNeed.clear();
    217244                                if ( auto c = commonType( toType, adjType, newEnv, newNeed, have, newOpen, WidenMode {true, true} ) ) {
    218245                                        // set up binding slot for recursive assertions
     
    223250                                        }
    224251
    225                                         matches.emplace_back(
     252                                        inexactMatches.emplace_back(
    226253                                                cdata, adjType, std::move( newEnv ), std::move( have ), std::move( newNeed ),
    227254                                                std::move( newOpen ), crntResnSlot );
    228255                                }
    229256                        }
    230                         else {
    231                                 if ( unifyExact( toType, adjType, newEnv, newNeed, have, newOpen, WidenMode {true, true} ) ) {
    232                                         // set up binding slot for recursive assertions
    233                                         ast::UniqueId crntResnSlot = 0;
    234                                         if ( ! newNeed.empty() ) {
    235                                                 crntResnSlot = ++globalResnSlot;
    236                                                 for ( auto & a : newNeed ) { a.second.resnSlot = crntResnSlot; }
    237                                         }
    238 
    239                                         matches.emplace_back(
    240                                                 cdata, adjType, std::move( newEnv ), std::move( have ), std::move( newNeed ),
    241                                                 std::move( newOpen ), crntResnSlot );
    242                                 }
    243                         }
    244257                }
    245258
    246259                // break if no satisfying match
    247                 if ( matches.empty() ) return false;
     260                if ( matches.empty() ) matches = std::move(inexactMatches);
     261                if ( matches.empty() ) return AssertionResult::Fail;
    248262
    249263                // defer if too many satisfying matches
    250264                if ( matches.size() > 1 ) {
    251265                        sat.deferred.emplace_back( assn.first, assn.second, std::move( matches ) );
    252                         return true;
     266                        return AssertionResult::Success;
    253267                }
    254268
    255269                // otherwise bind unique match in ongoing scope
    256270                AssnCandidate & match = matches.front();
    257                 addToSymbolTable( match.have, sat.symtab );
     271                // addToSymbolTable( match.have, sat.symtab );
    258272                sat.newNeed.insert( match.need.begin(), match.need.end() );
    259273                sat.cand->env = std::move( match.env );
     
    261275
    262276                bindAssertion( assn.first, assn.second, sat.cand, match, sat.inferred );
    263                 return true;
     277                return AssertionResult::Success;
    264278        }
    265279
     
    438452                // for each current mutually-compatible set of assertions
    439453                for ( SatState & sat : sats ) {
    440                         bool allowConversion = false;
    441454                        // stop this branch if a better option is already found
    442455                        auto it = thresholds.find( pruneKey( *sat.cand ) );
     
    447460                        for (unsigned resetCount = 0; ; ++resetCount) {
    448461                                ast::AssertionList next;
    449                                 resetTyVarRenaming();
    450462                                // make initial pass at matching assertions
    451463                                for ( auto & assn : sat.need ) {
     464                                        resetTyVarRenaming();
    452465                                        // fail early if any assertion is not satisfiable
    453                                         if ( ! satisfyAssertion( assn, sat, allowConversion, !next.empty() ) ) {
    454                                                 next.emplace_back(assn);
    455                                                 // goto nextSat;
    456                                         }
    457                                 }
    458                                 // success
    459                                 if (next.empty()) break;
    460                                 // fail if nothing resolves
    461                                 else if (next.size() == sat.need.size()) {
    462                                         if (allowConversion) {
     466                                        auto result = satisfyAssertion( assn, sat, !next.empty() );
     467                                        if ( result == AssertionResult::Fail ) {
    463468                                                Indenter tabs{ 3 };
    464469                                                std::ostringstream ss;
     
    466471                                                print( ss, *sat.cand, ++tabs );
    467472                                                ss << (tabs-1) << "Could not satisfy assertion:\n";
    468                                                 ast::print( ss, next[0].first, tabs );
     473                                                ast::print( ss, assn.first, tabs );
    469474
    470475                                                errors.emplace_back( ss.str() );
    471476                                                goto nextSat;
    472477                                        }
    473 
    474                                         else {
    475                                                 allowConversion = true;
    476                                                 continue;
    477                                         }
    478                                 }
    479                                 allowConversion = false;
     478                                        else if ( result == AssertionResult::Skip ) {
     479                                                next.emplace_back(assn);
     480                                                // goto nextSat;
     481                                        }
     482                                }
     483                                // success
     484                                if (next.empty()) break;
     485
    480486                                sat.need = std::move(next);
    481487                        }
     
    531537                                                sat.cand->expr, std::move( compat.env ), std::move( compat.open ),
    532538                                                ast::AssertionSet{} /* need moved into satisfaction state */,
    533                                                 sat.cand->cost, sat.cand->cvtCost );
     539                                                sat.cand->cost );
    534540
    535541                                        ast::AssertionSet nextNewNeed{ sat.newNeed };
     
    544550                                        for ( DeferRef r : compat.assns ) {
    545551                                                AssnCandidate match = r.match;
    546                                                 addToSymbolTable( match.have, nextSymtab );
     552                                                // addToSymbolTable( match.have, nextSymtab );
    547553                                                nextNewNeed.insert( match.need.begin(), match.need.end() );
    548554
  • src/ResolvExpr/Unify.cc

    r0b0a285 rc84dd61  
    160160                env.apply( newSecond );
    161161
    162                 findOpenVars( newFirst, open, closed, need, have, FirstClosed );
    163                 findOpenVars( newSecond, open, closed, need, have, FirstOpen );
     162                // findOpenVars( newFirst, open, closed, need, have, FirstClosed );
     163                findOpenVars( newSecond, open, closed, need, have, newEnv, FirstOpen );
    164164
    165165                return unifyExact(newFirst, newSecond, newEnv, need, have, open, noWiden() );
     
    964964                        // check that the other type is compatible and named the same
    965965                        auto otherInst = dynamic_cast< const XInstType * >( other );
    966                         if (otherInst && inst->name == otherInst->name) this->result = otherInst;
     966                        if (otherInst && inst->name == otherInst->name)
     967                                this->result = otherInst;
    967968                        return otherInst;
    968969                }
     
    10491050
    10501051                void postvisit( const ast::TypeInstType * typeInst ) {
    1051                         assert( open.find( *typeInst ) == open.end() );
    1052                         handleRefType( typeInst, type2 );
     1052                        // assert( open.find( *typeInst ) == open.end() );
     1053                        auto otherInst = dynamic_cast< const ast::TypeInstType * >( type2 );
     1054                        if (otherInst && typeInst->name == otherInst->name)
     1055                                this->result = otherInst;
     1056                        // return otherInst;
    10531057                }
    10541058
     
    11611165        ) {
    11621166                ast::OpenVarSet closed;
    1163                 findOpenVars( type1, open, closed, need, have, FirstClosed );
    1164                 findOpenVars( type2, open, closed, need, have, FirstOpen );
     1167                // findOpenVars( type1, open, closed, need, have, FirstClosed );
     1168                findOpenVars( type2, open, closed, need, have, env, FirstOpen );
    11651169                return unifyInexact(
    11661170                        type1, type2, env, need, have, open, WidenMode{ true, true }, common );
     
    11791183                        entry1 = var1 ? open.find( *var1 ) : open.end(),
    11801184                        entry2 = var2 ? open.find( *var2 ) : open.end();
    1181                 bool isopen1 = entry1 != open.end();
    1182                 bool isopen2 = entry2 != open.end();
    1183 
     1185                // bool isopen1 = entry1 != open.end();
     1186                // bool isopen2 = entry2 != open.end();
     1187                bool isopen1 = var1 && env.lookup(*var1);
     1188                bool isopen2 = var2 && env.lookup(*var2);
     1189
     1190                /*
    11841191                if ( isopen1 && isopen2 ) {
    11851192                        if ( entry1->second.kind != entry2->second.kind ) return false;
     
    11901197                        return env.bindVar( var1, type2, entry1->second, need, have, open, widen );
    11911198                } else if ( isopen2 ) {
    1192                         return env.bindVar( var2, type1, entry2->second, need, have, open, widen );
    1193                 } else {
     1199                        return env.bindVar( var2, type1, entry2->second, need, have, open, widen, symtab );
     1200                } */
     1201                if ( isopen1 && isopen2 ) {
     1202                        if ( var1->base->kind != var2->base->kind ) return false;
     1203                        return env.bindVarToVar(
     1204                                var1, var2, ast::TypeData{ var1->base->kind, var1->base->sized||var2->base->sized }, need, have,
     1205                                open, widen );
     1206                } else if ( isopen1 ) {
     1207                        return env.bindVar( var1, type2, ast::TypeData{var1->base}, need, have, open, widen );
     1208                } else if ( isopen2 ) {
     1209                        return env.bindVar( var2, type1, ast::TypeData{var2->base}, need, have, open, widen );
     1210                }else {
    11941211                        return ast::Pass<Unify_new>::read(
    11951212                                type1, type2, env, need, have, open, widen );
    11961213                }
     1214               
    11971215        }
    11981216
  • src/SynTree/Expression.cc

    r0b0a285 rc84dd61  
    267267}
    268268
    269 CastExpr::CastExpr( Expression * arg, Type * toType, bool isGenerated ) : arg(arg), isGenerated( isGenerated ) {
     269CastExpr::CastExpr( Expression * arg, Type * toType, bool isGenerated, CastKind kind ) : arg(arg), isGenerated( isGenerated ), kind( kind ) {
    270270        set_result(toType);
    271271}
    272272
    273 CastExpr::CastExpr( Expression * arg, bool isGenerated ) : arg(arg), isGenerated( isGenerated ) {
     273CastExpr::CastExpr( Expression * arg, bool isGenerated, CastKind kind ) : arg(arg), isGenerated( isGenerated ), kind( kind ) {
    274274        set_result( new VoidType( Type::Qualifiers() ) );
    275275}
    276276
    277 CastExpr::CastExpr( const CastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
     277CastExpr::CastExpr( const CastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ), kind( other.kind ) {
    278278}
    279279
  • src/SynTree/Expression.h

    r0b0a285 rc84dd61  
    271271        bool isGenerated = true;
    272272
    273         CastExpr( Expression * arg, bool isGenerated = true );
    274         CastExpr( Expression * arg, Type * toType, bool isGenerated = true );
     273        enum CastKind {
     274                Default, // C
     275                Coerce, // reinterpret cast
     276                Return  // overload selection
     277        };
     278
     279        CastKind kind = Default;
     280
     281        CastExpr( Expression * arg, bool isGenerated = true, CastKind kind = Default );
     282        CastExpr( Expression * arg, Type * toType, bool isGenerated = true, CastKind kind = Default );
    275283        CastExpr( Expression * arg, void * ) = delete; // prevent accidentally passing pointers for isGenerated in the first constructor
    276284        CastExpr( const CastExpr & other );
  • src/Tuples/TupleAssignment.cc

    r0b0a285 rc84dd61  
    679679
    680680                                ResolvExpr::CandidateFinder finder( crntFinder.context, matcher->env );
     681                                finder.allowVoid = true;
    681682
    682683                                try {
  • src/Validate/Autogen.cpp

    r0b0a285 rc84dd61  
    321321void FuncGenerator::produceDecl( const ast::FunctionDecl * decl ) {
    322322        assert( nullptr != decl->stmts );
     323        assert( decl->type_params.size() == getGenericParams( type ).size() );
    323324
    324325        definitions.push_back( decl );
     
    356357                decl->init = nullptr;
    357358                splice( assertions, decl->assertions );
    358                 oldToNew.emplace( std::make_pair( old_param, decl ) );
     359                oldToNew.emplace( old_param, decl );
    359360                type_params.push_back( decl );
    360361        }
     
    522523        InitTweak::InitExpander_new srcParam( src );
    523524        // Assign to destination.
    524         ast::Expr * dstSelect = new ast::MemberExpr(
     525        ast::MemberExpr * dstSelect = new ast::MemberExpr(
    525526                location,
    526527                field,
     
    574575                }
    575576
    576                 ast::Expr * srcSelect = (srcParam) ? new ast::MemberExpr(
     577                ast::MemberExpr * srcSelect = (srcParam) ? new ast::MemberExpr(
    577578                        location, field, new ast::VariableExpr( location, srcParam )
    578579                ) : nullptr;
  • src/Validate/GenericParameter.cpp

    r0b0a285 rc84dd61  
    120120}
    121121
    122 struct ValidateGenericParamsCore : public ast::WithCodeLocation {
     122bool isSizedPolymorphic( const ast::AggregateDecl * decl ) {
     123        for ( const auto & param : decl->params ) {
     124                if ( param->sized ) return true;
     125        }
     126        return false;
     127}
     128
     129struct ValidateGenericParamsCore :
     130                public ast::WithCodeLocation, public ast::WithGuards {
     131        // Generic parameter filling and checks:
    123132        const ast::StructInstType * previsit( const ast::StructInstType * type ) {
    124133                assert( location );
     
    129138                assert( location );
    130139                return validateGeneric( *location, type );
     140        }
     141
     142        // Check parameter and bitfield combinations:
     143        bool insideSized = false;
     144        void previsit( const ast::StructDecl * decl ) {
     145                if ( isSizedPolymorphic( decl ) && !insideSized ) {
     146                        GuardValue( insideSized ) = true;
     147                }
     148        }
     149
     150        void previsit( const ast::UnionDecl * decl ) {
     151                if ( isSizedPolymorphic( decl ) && !insideSized ) {
     152                        GuardValue( insideSized ) = true;
     153                }
     154        }
     155
     156        void previsit( const ast::ObjectDecl * decl ) {
     157                if ( insideSized && decl->bitfieldWidth ) {
     158                        SemanticError( decl->location, decl,
     159                                "Cannot have bitfields inside a sized polymorphic structure." );
     160                }
    131161        }
    132162};
  • src/Validate/LinkReferenceToTypes.cpp

    r0b0a285 rc84dd61  
    8484                // Just linking in the node.
    8585                auto mut = ast::mutate( type );
    86                 mut->base = const_cast<ast::EnumDecl *>( decl );
     86                mut->base = decl;
    8787                type = mut;
    8888        }
     
    101101                // Just linking in the node.
    102102                auto mut = ast::mutate( type );
    103                 mut->base = const_cast<ast::StructDecl *>( decl );
     103                mut->base = decl;
    104104                type = mut;
    105105        }
     
    118118                // Just linking in the node.
    119119                auto mut = ast::mutate( type );
    120                 mut->base = const_cast<ast::UnionDecl *>( decl );
     120                mut->base = decl;
    121121                type = mut;
    122122        }
     
    141141
    142142        // Just linking in the node.
    143         mut->base = const_cast<ast::TraitDecl *>( decl );
     143        mut->base = decl;
    144144
    145145        // Need to carry over the 'sized' status of each decl in the instance.
     
    203203        }
    204204
    205         // The following section
    206 
    207205        ForwardEnumsType::iterator fwds = forwardEnums.find( decl->name );
    208206        if ( fwds != forwardEnums.end() ) {
  • src/Virtual/VirtualDtor.cpp

    r0b0a285 rc84dd61  
    146146
    147147            CompoundStmt * dtorBody = mutate( decl->stmts.get() );
    148             // Adds the following to the end of any actor/message dtor:
     148            // Adds the following to the start of any actor/message dtor:
    149149            //  __CFA_dtor_shutdown( this );
    150             dtorBody->push_front( new ExprStmt(
    151                 decl->location,
    152                                 new UntypedExpr (
    153                     decl->location,
    154                                         new NameExpr( decl->location, "__CFA_dtor_shutdown" ),
    155                                         {
    156                         new NameExpr( decl->location, decl->params.at(0)->name )
    157                                         }
    158                                 )
    159                         ));
     150            dtorBody->push_front(
     151                new IfStmt( decl->location,
     152                    new UntypedExpr (
     153                        decl->location,
     154                        new NameExpr( decl->location, "__CFA_dtor_shutdown" ),
     155                        {
     156                            new NameExpr( decl->location, decl->params.at(0)->name )
     157                        }
     158                    ),
     159                    new ReturnStmt( decl->location, nullptr )
     160                )
     161            );
    160162            return;
    161163        }
  • src/main.cc

    r0b0a285 rc84dd61  
    2828#include <list>                             // for list
    2929#include <string>                           // for char_traits, operator<<
    30 
    31 using namespace std;
    3230
    3331#include "AST/Convert.hpp"
     
    8886#include "Virtual/VirtualDtor.hpp"           // for implementVirtDtors
    8987
     88using namespace std;
     89
    9090static void NewPass( const char * const name ) {
    9191        Stats::Heap::newPass( name );
     
    335335
    336336                PASS( "Fix Qualified Types", Validate::fixQualifiedTypes, transUnit );
     337                PASS( "Eliminate Typedef", Validate::eliminateTypedef, transUnit );
    337338                PASS( "Hoist Struct", Validate::hoistStruct, transUnit );
    338                 PASS( "Eliminate Typedef", Validate::eliminateTypedef, transUnit );
    339339                PASS( "Validate Generic Parameters", Validate::fillGenericParameters, transUnit );
    340340                PASS( "Translate Dimensions", Validate::translateDimensionParameters, transUnit );
  • tests/.expect/mathX.arm64.txt

    r0b0a285 rc84dd61  
    787787ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    788788ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    789 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    790 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    791 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    792 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    793 ceiling(64, 64) = 64, ceiling(66, 64) = -128, ceiling(-66, 64) = 0
    794 ceiling(-128, -128) = -128, ceiling(-126, -128) = -128, ceiling(126, -128) = 0
     789ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     790ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     791ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     792ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     793ceiling(64, 64) = 64, ceiling(66, 64) = -128, ceiling(-66, 64) = -64
     794ceiling(-128, -128) = -128, ceiling(-126, -128) = 0, ceiling(126, -128) = -128
    795795
    796796unsigned char
     
    807807ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    808808ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    809 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    810 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    811 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    812 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    813 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    814 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    815 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    816 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    817 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    818 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    819 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    820 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    821 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = -32768, ceiling(-16386, 16384) = 0
    822 ceiling(-32768, -32768) = -32768, ceiling(-32766, -32768) = -32768, ceiling(32766, -32768) = 0
     809ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     810ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     811ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     812ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     813ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     814ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     815ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     816ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     817ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     818ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     819ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     820ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     821ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = -32768, ceiling(-16386, 16384) = -16384
     822ceiling(-32768, -32768) = -32768, ceiling(-32766, -32768) = 0, ceiling(32766, -32768) = -32768
    823823
    824824unsigned short int
     
    843843ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    844844ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    845 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    846 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    847 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    848 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    849 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    850 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    851 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    852 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    853 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    854 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    855 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    856 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    857 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = 0
    858 ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = 0
    859 ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = 0
    860 ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = 0
    861 ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = 0
    862 ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = 0
    863 ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = 0
    864 ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = 0
    865 ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = 0
    866 ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = 0
    867 ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = 0
    868 ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = 0
    869 ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = 0
    870 ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = 0
    871 ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = 0
    872 ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = 0
    873 ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = -1073741824, ceiling(-1073741826, 1073741824) = 0
    874 ceiling(-2147483648, -2147483648) = -2147483648, ceiling(-2147483646, -2147483648) = 0, ceiling(2147483646, -2147483648) = 0
     845ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     846ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     847ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     848ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     849ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     850ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     851ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     852ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     853ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     854ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     855ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     856ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     857ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = -16384
     858ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = -32768
     859ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = -65536
     860ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = -131072
     861ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = -262144
     862ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = -524288
     863ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = -1048576
     864ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = -2097152
     865ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = -4194304
     866ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = -8388608
     867ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = -16777216
     868ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = -33554432
     869ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = -67108864
     870ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = -134217728
     871ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = -268435456
     872ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = -536870912
     873ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = -2147483648, ceiling(-1073741826, 1073741824) = -1073741824
     874ceiling(-2147483648, -2147483648) = -2147483648, ceiling(-2147483646, -2147483648) = 0, ceiling(2147483646, -2147483648) = -2147483648
    875875
    876876unsigned int
     
    911911ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    912912ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    913 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    914 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    915 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    916 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    917 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    918 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    919 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    920 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    921 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    922 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    923 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    924 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    925 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = 0
    926 ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = 0
    927 ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = 0
    928 ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = 0
    929 ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = 0
    930 ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = 0
    931 ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = 0
    932 ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = 0
    933 ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = 0
    934 ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = 0
    935 ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = 0
    936 ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = 0
    937 ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = 0
    938 ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = 0
    939 ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = 0
    940 ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = 0
    941 ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = 0
    942 ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = 0
    943 ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = 0
    944 ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = 0
    945 ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = 0
    946 ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = 0
    947 ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = 0
    948 ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = 0
    949 ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = 0
    950 ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = 0
    951 ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = 0
    952 ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = 0
    953 ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = 0
    954 ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = 0
    955 ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = 0
    956 ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = 0
    957 ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = 0
    958 ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = 0
    959 ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = 0
    960 ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = 0
    961 ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = 0
    962 ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = 0
    963 ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = 0
    964 ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = 0
    965 ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = 0
    966 ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = 0
    967 ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = 0
    968 ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = 0
    969 ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = 0
    970 ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = 0
    971 ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = 0
    972 ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = 0
    973 ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -4611686018427387904, ceiling(-4611686018427387906, 4611686018427387904) = 0
    974 ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = 0
     913ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     914ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     915ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     916ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     917ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     918ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     919ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     920ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     921ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     922ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     923ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     924ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     925ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = -16384
     926ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = -32768
     927ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = -65536
     928ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = -131072
     929ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = -262144
     930ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = -524288
     931ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = -1048576
     932ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = -2097152
     933ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = -4194304
     934ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = -8388608
     935ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = -16777216
     936ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = -33554432
     937ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = -67108864
     938ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = -134217728
     939ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = -268435456
     940ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = -536870912
     941ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = -1073741824
     942ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = -2147483648
     943ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = -4294967296
     944ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = -8589934592
     945ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = -17179869184
     946ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = -34359738368
     947ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = -68719476736
     948ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = -137438953472
     949ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = -274877906944
     950ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = -549755813888
     951ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = -1099511627776
     952ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = -2199023255552
     953ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = -4398046511104
     954ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = -8796093022208
     955ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = -17592186044416
     956ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = -35184372088832
     957ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = -70368744177664
     958ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = -140737488355328
     959ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = -281474976710656
     960ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = -562949953421312
     961ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = -1125899906842624
     962ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = -2251799813685248
     963ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = -4503599627370496
     964ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = -9007199254740992
     965ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = -18014398509481984
     966ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = -36028797018963968
     967ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = -72057594037927936
     968ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = -144115188075855872
     969ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = -288230376151711744
     970ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = -576460752303423488
     971ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = -1152921504606846976
     972ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = -2305843009213693952
     973ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -9223372036854775808, ceiling(-4611686018427387906, 4611686018427387904) = -4611686018427387904
     974ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = -9223372036854775808
    975975
    976976unsigned long int
     
    10431043ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    10441044ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    1045 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    1046 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    1047 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    1048 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    1049 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    1050 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    1051 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    1052 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    1053 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    1054 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    1055 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    1056 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    1057 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = 0
    1058 ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = 0
    1059 ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = 0
    1060 ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = 0
    1061 ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = 0
    1062 ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = 0
    1063 ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = 0
    1064 ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = 0
    1065 ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = 0
    1066 ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = 0
    1067 ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = 0
    1068 ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = 0
    1069 ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = 0
    1070 ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = 0
    1071 ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = 0
    1072 ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = 0
    1073 ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = 0
    1074 ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = 0
    1075 ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = 0
    1076 ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = 0
    1077 ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = 0
    1078 ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = 0
    1079 ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = 0
    1080 ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = 0
    1081 ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = 0
    1082 ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = 0
    1083 ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = 0
    1084 ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = 0
    1085 ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = 0
    1086 ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = 0
    1087 ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = 0
    1088 ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = 0
    1089 ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = 0
    1090 ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = 0
    1091 ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = 0
    1092 ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = 0
    1093 ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = 0
    1094 ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = 0
    1095 ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = 0
    1096 ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = 0
    1097 ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = 0
    1098 ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = 0
    1099 ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = 0
    1100 ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = 0
    1101 ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = 0
    1102 ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = 0
    1103 ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = 0
    1104 ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = 0
    1105 ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -4611686018427387904, ceiling(-4611686018427387906, 4611686018427387904) = 0
    1106 ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = 0
     1045ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     1046ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     1047ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     1048ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     1049ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     1050ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     1051ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     1052ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     1053ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     1054ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     1055ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     1056ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     1057ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = -16384
     1058ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = -32768
     1059ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = -65536
     1060ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = -131072
     1061ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = -262144
     1062ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = -524288
     1063ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = -1048576
     1064ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = -2097152
     1065ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = -4194304
     1066ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = -8388608
     1067ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = -16777216
     1068ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = -33554432
     1069ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = -67108864
     1070ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = -134217728
     1071ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = -268435456
     1072ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = -536870912
     1073ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = -1073741824
     1074ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = -2147483648
     1075ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = -4294967296
     1076ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = -8589934592
     1077ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = -17179869184
     1078ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = -34359738368
     1079ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = -68719476736
     1080ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = -137438953472
     1081ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = -274877906944
     1082ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = -549755813888
     1083ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = -1099511627776
     1084ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = -2199023255552
     1085ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = -4398046511104
     1086ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = -8796093022208
     1087ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = -17592186044416
     1088ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = -35184372088832
     1089ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = -70368744177664
     1090ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = -140737488355328
     1091ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = -281474976710656
     1092ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = -562949953421312
     1093ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = -1125899906842624
     1094ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = -2251799813685248
     1095ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = -4503599627370496
     1096ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = -9007199254740992
     1097ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = -18014398509481984
     1098ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = -36028797018963968
     1099ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = -72057594037927936
     1100ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = -144115188075855872
     1101ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = -288230376151711744
     1102ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = -576460752303423488
     1103ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = -1152921504606846976
     1104ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = -2305843009213693952
     1105ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -9223372036854775808, ceiling(-4611686018427387906, 4611686018427387904) = -4611686018427387904
     1106ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = -9223372036854775808
    11071107
    11081108unsigned long long int
  • tests/.expect/mathX.x64.txt

    r0b0a285 rc84dd61  
    787787ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    788788ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    789 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    790 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    791 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    792 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    793 ceiling(64, 64) = 64, ceiling(66, 64) = -128, ceiling(-66, 64) = 0
    794 ceiling(-128, -128) = -128, ceiling(-126, -128) = -128, ceiling(126, -128) = 0
     789ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     790ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     791ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     792ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     793ceiling(64, 64) = 64, ceiling(66, 64) = -128, ceiling(-66, 64) = -64
     794ceiling(-128, -128) = -128, ceiling(-126, -128) = 0, ceiling(126, -128) = -128
    795795
    796796unsigned char
     
    807807ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    808808ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    809 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    810 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    811 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    812 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    813 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    814 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    815 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    816 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    817 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    818 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    819 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    820 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    821 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = -32768, ceiling(-16386, 16384) = 0
    822 ceiling(-32768, -32768) = -32768, ceiling(-32766, -32768) = -32768, ceiling(32766, -32768) = 0
     809ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     810ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     811ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     812ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     813ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     814ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     815ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     816ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     817ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     818ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     819ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     820ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     821ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = -32768, ceiling(-16386, 16384) = -16384
     822ceiling(-32768, -32768) = -32768, ceiling(-32766, -32768) = 0, ceiling(32766, -32768) = -32768
    823823
    824824unsigned short int
     
    843843ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    844844ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    845 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    846 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    847 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    848 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    849 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    850 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    851 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    852 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    853 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    854 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    855 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    856 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    857 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = 0
    858 ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = 0
    859 ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = 0
    860 ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = 0
    861 ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = 0
    862 ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = 0
    863 ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = 0
    864 ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = 0
    865 ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = 0
    866 ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = 0
    867 ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = 0
    868 ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = 0
    869 ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = 0
    870 ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = 0
    871 ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = 0
    872 ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = 0
    873 ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = -1073741824, ceiling(-1073741826, 1073741824) = 0
    874 ceiling(-2147483648, -2147483648) = -2147483648, ceiling(-2147483646, -2147483648) = 0, ceiling(2147483646, -2147483648) = 0
     845ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     846ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     847ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     848ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     849ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     850ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     851ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     852ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     853ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     854ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     855ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     856ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     857ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = -16384
     858ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = -32768
     859ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = -65536
     860ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = -131072
     861ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = -262144
     862ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = -524288
     863ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = -1048576
     864ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = -2097152
     865ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = -4194304
     866ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = -8388608
     867ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = -16777216
     868ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = -33554432
     869ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = -67108864
     870ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = -134217728
     871ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = -268435456
     872ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = -536870912
     873ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = -2147483648, ceiling(-1073741826, 1073741824) = -1073741824
     874ceiling(-2147483648, -2147483648) = -2147483648, ceiling(-2147483646, -2147483648) = 0, ceiling(2147483646, -2147483648) = -2147483648
    875875
    876876unsigned int
     
    911911ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    912912ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    913 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    914 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    915 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    916 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    917 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    918 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    919 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    920 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    921 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    922 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    923 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    924 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    925 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = 0
    926 ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = 0
    927 ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = 0
    928 ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = 0
    929 ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = 0
    930 ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = 0
    931 ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = 0
    932 ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = 0
    933 ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = 0
    934 ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = 0
    935 ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = 0
    936 ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = 0
    937 ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = 0
    938 ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = 0
    939 ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = 0
    940 ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = 0
    941 ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = 0
    942 ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = 0
    943 ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = 0
    944 ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = 0
    945 ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = 0
    946 ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = 0
    947 ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = 0
    948 ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = 0
    949 ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = 0
    950 ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = 0
    951 ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = 0
    952 ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = 0
    953 ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = 0
    954 ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = 0
    955 ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = 0
    956 ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = 0
    957 ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = 0
    958 ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = 0
    959 ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = 0
    960 ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = 0
    961 ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = 0
    962 ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = 0
    963 ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = 0
    964 ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = 0
    965 ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = 0
    966 ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = 0
    967 ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = 0
    968 ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = 0
    969 ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = 0
    970 ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = 0
    971 ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = 0
    972 ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = 0
    973 ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -4611686018427387904, ceiling(-4611686018427387906, 4611686018427387904) = 0
    974 ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = 0
     913ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     914ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     915ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     916ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     917ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     918ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     919ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     920ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     921ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     922ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     923ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     924ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     925ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = -16384
     926ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = -32768
     927ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = -65536
     928ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = -131072
     929ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = -262144
     930ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = -524288
     931ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = -1048576
     932ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = -2097152
     933ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = -4194304
     934ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = -8388608
     935ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = -16777216
     936ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = -33554432
     937ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = -67108864
     938ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = -134217728
     939ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = -268435456
     940ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = -536870912
     941ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = -1073741824
     942ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = -2147483648
     943ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = -4294967296
     944ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = -8589934592
     945ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = -17179869184
     946ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = -34359738368
     947ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = -68719476736
     948ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = -137438953472
     949ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = -274877906944
     950ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = -549755813888
     951ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = -1099511627776
     952ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = -2199023255552
     953ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = -4398046511104
     954ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = -8796093022208
     955ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = -17592186044416
     956ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = -35184372088832
     957ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = -70368744177664
     958ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = -140737488355328
     959ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = -281474976710656
     960ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = -562949953421312
     961ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = -1125899906842624
     962ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = -2251799813685248
     963ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = -4503599627370496
     964ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = -9007199254740992
     965ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = -18014398509481984
     966ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = -36028797018963968
     967ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = -72057594037927936
     968ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = -144115188075855872
     969ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = -288230376151711744
     970ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = -576460752303423488
     971ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = -1152921504606846976
     972ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = -2305843009213693952
     973ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -9223372036854775808, ceiling(-4611686018427387906, 4611686018427387904) = -4611686018427387904
     974ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = -9223372036854775808
    975975
    976976unsigned long int
     
    10431043ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    10441044ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    1045 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    1046 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    1047 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    1048 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    1049 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    1050 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    1051 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    1052 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    1053 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    1054 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    1055 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    1056 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    1057 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = 0
    1058 ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = 0
    1059 ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = 0
    1060 ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = 0
    1061 ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = 0
    1062 ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = 0
    1063 ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = 0
    1064 ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = 0
    1065 ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = 0
    1066 ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = 0
    1067 ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = 0
    1068 ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = 0
    1069 ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = 0
    1070 ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = 0
    1071 ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = 0
    1072 ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = 0
    1073 ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = 0
    1074 ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = 0
    1075 ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = 0
    1076 ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = 0
    1077 ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = 0
    1078 ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = 0
    1079 ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = 0
    1080 ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = 0
    1081 ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = 0
    1082 ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = 0
    1083 ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = 0
    1084 ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = 0
    1085 ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = 0
    1086 ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = 0
    1087 ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = 0
    1088 ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = 0
    1089 ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = 0
    1090 ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = 0
    1091 ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = 0
    1092 ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = 0
    1093 ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = 0
    1094 ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = 0
    1095 ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = 0
    1096 ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = 0
    1097 ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = 0
    1098 ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = 0
    1099 ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = 0
    1100 ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = 0
    1101 ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = 0
    1102 ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = 0
    1103 ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = 0
    1104 ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = 0
    1105 ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -4611686018427387904, ceiling(-4611686018427387906, 4611686018427387904) = 0
    1106 ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = 0
     1045ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     1046ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     1047ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     1048ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     1049ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     1050ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     1051ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     1052ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     1053ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     1054ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     1055ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     1056ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     1057ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = -16384
     1058ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = -32768
     1059ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = -65536
     1060ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = -131072
     1061ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = -262144
     1062ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = -524288
     1063ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = -1048576
     1064ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = -2097152
     1065ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = -4194304
     1066ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = -8388608
     1067ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = -16777216
     1068ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = -33554432
     1069ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = -67108864
     1070ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = -134217728
     1071ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = -268435456
     1072ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = -536870912
     1073ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = -1073741824
     1074ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = -2147483648
     1075ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = -4294967296
     1076ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = -8589934592
     1077ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = -17179869184
     1078ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = -34359738368
     1079ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = -68719476736
     1080ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = -137438953472
     1081ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = -274877906944
     1082ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = -549755813888
     1083ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = -1099511627776
     1084ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = -2199023255552
     1085ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = -4398046511104
     1086ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = -8796093022208
     1087ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = -17592186044416
     1088ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = -35184372088832
     1089ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = -70368744177664
     1090ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = -140737488355328
     1091ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = -281474976710656
     1092ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = -562949953421312
     1093ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = -1125899906842624
     1094ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = -2251799813685248
     1095ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = -4503599627370496
     1096ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = -9007199254740992
     1097ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = -18014398509481984
     1098ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = -36028797018963968
     1099ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = -72057594037927936
     1100ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = -144115188075855872
     1101ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = -288230376151711744
     1102ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = -576460752303423488
     1103ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = -1152921504606846976
     1104ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = -2305843009213693952
     1105ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -9223372036854775808, ceiling(-4611686018427387906, 4611686018427387904) = -4611686018427387904
     1106ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = -9223372036854775808
    11071107
    11081108unsigned long long int
  • tests/.expect/mathX.x86.txt

    r0b0a285 rc84dd61  
    659659ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    660660ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    661 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    662 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    663 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    664 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    665 ceiling(64, 64) = 64, ceiling(66, 64) = -128, ceiling(-66, 64) = 0
    666 ceiling(-128, -128) = -128, ceiling(-126, -128) = -128, ceiling(126, -128) = 0
     661ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     662ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     663ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     664ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     665ceiling(64, 64) = 64, ceiling(66, 64) = -128, ceiling(-66, 64) = -64
     666ceiling(-128, -128) = -128, ceiling(-126, -128) = 0, ceiling(126, -128) = -128
    667667
    668668unsigned char
     
    679679ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    680680ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    681 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    682 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    683 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    684 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    685 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    686 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    687 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    688 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    689 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    690 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    691 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    692 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    693 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = -32768, ceiling(-16386, 16384) = 0
    694 ceiling(-32768, -32768) = -32768, ceiling(-32766, -32768) = -32768, ceiling(32766, -32768) = 0
     681ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     682ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     683ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     684ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     685ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     686ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     687ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     688ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     689ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     690ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     691ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     692ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     693ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = -32768, ceiling(-16386, 16384) = -16384
     694ceiling(-32768, -32768) = -32768, ceiling(-32766, -32768) = 0, ceiling(32766, -32768) = -32768
    695695
    696696unsigned short int
     
    715715ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    716716ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    717 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    718 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    719 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    720 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    721 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    722 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    723 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    724 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    725 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    726 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    727 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    728 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    729 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = 0
    730 ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = 0
    731 ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = 0
    732 ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = 0
    733 ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = 0
    734 ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = 0
    735 ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = 0
    736 ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = 0
    737 ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = 0
    738 ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = 0
    739 ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = 0
    740 ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = 0
    741 ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = 0
    742 ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = 0
    743 ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = 0
    744 ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = 0
    745 ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = -1073741824, ceiling(-1073741826, 1073741824) = 0
    746 ceiling(-2147483648, -2147483648) = -2147483648, ceiling(-2147483646, -2147483648) = 0, ceiling(2147483646, -2147483648) = 0
     717ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     718ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     719ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     720ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     721ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     722ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     723ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     724ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     725ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     726ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     727ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     728ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     729ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = -16384
     730ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = -32768
     731ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = -65536
     732ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = -131072
     733ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = -262144
     734ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = -524288
     735ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = -1048576
     736ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = -2097152
     737ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = -4194304
     738ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = -8388608
     739ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = -16777216
     740ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = -33554432
     741ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = -67108864
     742ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = -134217728
     743ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = -268435456
     744ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = -536870912
     745ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = -2147483648, ceiling(-1073741826, 1073741824) = -1073741824
     746ceiling(-2147483648, -2147483648) = -2147483648, ceiling(-2147483646, -2147483648) = 0, ceiling(2147483646, -2147483648) = -2147483648
    747747
    748748unsigned int
     
    783783ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    784784ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    785 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    786 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    787 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    788 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    789 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    790 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    791 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    792 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    793 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    794 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    795 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    796 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    797 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = 0
    798 ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = 0
    799 ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = 0
    800 ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = 0
    801 ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = 0
    802 ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = 0
    803 ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = 0
    804 ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = 0
    805 ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = 0
    806 ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = 0
    807 ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = 0
    808 ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = 0
    809 ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = 0
    810 ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = 0
    811 ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = 0
    812 ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = 0
    813 ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = -1073741824, ceiling(-1073741826, 1073741824) = 0
    814 ceiling(-2147483648, -2147483648) = -2147483648, ceiling(-2147483646, -2147483648) = 0, ceiling(2147483646, -2147483648) = 0
     785ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     786ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     787ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     788ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     789ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     790ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     791ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     792ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     793ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     794ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     795ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     796ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     797ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = -16384
     798ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = -32768
     799ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = -65536
     800ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = -131072
     801ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = -262144
     802ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = -524288
     803ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = -1048576
     804ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = -2097152
     805ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = -4194304
     806ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = -8388608
     807ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = -16777216
     808ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = -33554432
     809ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = -67108864
     810ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = -134217728
     811ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = -268435456
     812ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = -536870912
     813ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = -2147483648, ceiling(-1073741826, 1073741824) = -1073741824
     814ceiling(-2147483648, -2147483648) = -2147483648, ceiling(-2147483646, -2147483648) = 0, ceiling(2147483646, -2147483648) = -2147483648
    815815
    816816unsigned long int
     
    851851ceiling(1, 1) = 1, ceiling(3, 1) = 3, ceiling(-3, 1) = -3
    852852ceiling(2, 2) = 2, ceiling(4, 2) = 4, ceiling(-4, 2) = -4
    853 ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = 0
    854 ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = 0
    855 ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = 0
    856 ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = 0
    857 ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = 0
    858 ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = 0
    859 ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = 0
    860 ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = 0
    861 ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = 0
    862 ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = 0
    863 ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = 0
    864 ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = 0
    865 ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = 0
    866 ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = 0
    867 ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = 0
    868 ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = 0
    869 ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = 0
    870 ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = 0
    871 ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = 0
    872 ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = 0
    873 ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = 0
    874 ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = 0
    875 ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = 0
    876 ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = 0
    877 ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = 0
    878 ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = 0
    879 ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = 0
    880 ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = 0
    881 ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = 0
    882 ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = 0
    883 ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = 0
    884 ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = 0
    885 ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = 0
    886 ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = 0
    887 ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = 0
    888 ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = 0
    889 ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = 0
    890 ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = 0
    891 ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = 0
    892 ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = 0
    893 ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = 0
    894 ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = 0
    895 ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = 0
    896 ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = 0
    897 ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = 0
    898 ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = 0
    899 ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = 0
    900 ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = 0
    901 ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = 0
    902 ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = 0
    903 ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = 0
    904 ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = 0
    905 ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = 0
    906 ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = 0
    907 ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = 0
    908 ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = 0
    909 ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = 0
    910 ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = 0
    911 ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = 0
    912 ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = 0
    913 ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -4611686018427387904, ceiling(-4611686018427387906, 4611686018427387904) = 0
    914 ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = 0
     853ceiling(4, 4) = 4, ceiling(6, 4) = 8, ceiling(-6, 4) = -4
     854ceiling(8, 8) = 8, ceiling(10, 8) = 16, ceiling(-10, 8) = -8
     855ceiling(16, 16) = 16, ceiling(18, 16) = 32, ceiling(-18, 16) = -16
     856ceiling(32, 32) = 32, ceiling(34, 32) = 64, ceiling(-34, 32) = -32
     857ceiling(64, 64) = 64, ceiling(66, 64) = 128, ceiling(-66, 64) = -64
     858ceiling(128, 128) = 128, ceiling(130, 128) = 256, ceiling(-130, 128) = -128
     859ceiling(256, 256) = 256, ceiling(258, 256) = 512, ceiling(-258, 256) = -256
     860ceiling(512, 512) = 512, ceiling(514, 512) = 1024, ceiling(-514, 512) = -512
     861ceiling(1024, 1024) = 1024, ceiling(1026, 1024) = 2048, ceiling(-1026, 1024) = -1024
     862ceiling(2048, 2048) = 2048, ceiling(2050, 2048) = 4096, ceiling(-2050, 2048) = -2048
     863ceiling(4096, 4096) = 4096, ceiling(4098, 4096) = 8192, ceiling(-4098, 4096) = -4096
     864ceiling(8192, 8192) = 8192, ceiling(8194, 8192) = 16384, ceiling(-8194, 8192) = -8192
     865ceiling(16384, 16384) = 16384, ceiling(16386, 16384) = 32768, ceiling(-16386, 16384) = -16384
     866ceiling(32768, 32768) = 32768, ceiling(32770, 32768) = 65536, ceiling(-32770, 32768) = -32768
     867ceiling(65536, 65536) = 65536, ceiling(65538, 65536) = 131072, ceiling(-65538, 65536) = -65536
     868ceiling(131072, 131072) = 131072, ceiling(131074, 131072) = 262144, ceiling(-131074, 131072) = -131072
     869ceiling(262144, 262144) = 262144, ceiling(262146, 262144) = 524288, ceiling(-262146, 262144) = -262144
     870ceiling(524288, 524288) = 524288, ceiling(524290, 524288) = 1048576, ceiling(-524290, 524288) = -524288
     871ceiling(1048576, 1048576) = 1048576, ceiling(1048578, 1048576) = 2097152, ceiling(-1048578, 1048576) = -1048576
     872ceiling(2097152, 2097152) = 2097152, ceiling(2097154, 2097152) = 4194304, ceiling(-2097154, 2097152) = -2097152
     873ceiling(4194304, 4194304) = 4194304, ceiling(4194306, 4194304) = 8388608, ceiling(-4194306, 4194304) = -4194304
     874ceiling(8388608, 8388608) = 8388608, ceiling(8388610, 8388608) = 16777216, ceiling(-8388610, 8388608) = -8388608
     875ceiling(16777216, 16777216) = 16777216, ceiling(16777218, 16777216) = 33554432, ceiling(-16777218, 16777216) = -16777216
     876ceiling(33554432, 33554432) = 33554432, ceiling(33554434, 33554432) = 67108864, ceiling(-33554434, 33554432) = -33554432
     877ceiling(67108864, 67108864) = 67108864, ceiling(67108866, 67108864) = 134217728, ceiling(-67108866, 67108864) = -67108864
     878ceiling(134217728, 134217728) = 134217728, ceiling(134217730, 134217728) = 268435456, ceiling(-134217730, 134217728) = -134217728
     879ceiling(268435456, 268435456) = 268435456, ceiling(268435458, 268435456) = 536870912, ceiling(-268435458, 268435456) = -268435456
     880ceiling(536870912, 536870912) = 536870912, ceiling(536870914, 536870912) = 1073741824, ceiling(-536870914, 536870912) = -536870912
     881ceiling(1073741824, 1073741824) = 1073741824, ceiling(1073741826, 1073741824) = 2147483648, ceiling(-1073741826, 1073741824) = -1073741824
     882ceiling(2147483648, 2147483648) = 2147483648, ceiling(2147483650, 2147483648) = 4294967296, ceiling(-2147483650, 2147483648) = -2147483648
     883ceiling(4294967296, 4294967296) = 4294967296, ceiling(4294967298, 4294967296) = 8589934592, ceiling(-4294967298, 4294967296) = -4294967296
     884ceiling(8589934592, 8589934592) = 8589934592, ceiling(8589934594, 8589934592) = 17179869184, ceiling(-8589934594, 8589934592) = -8589934592
     885ceiling(17179869184, 17179869184) = 17179869184, ceiling(17179869186, 17179869184) = 34359738368, ceiling(-17179869186, 17179869184) = -17179869184
     886ceiling(34359738368, 34359738368) = 34359738368, ceiling(34359738370, 34359738368) = 68719476736, ceiling(-34359738370, 34359738368) = -34359738368
     887ceiling(68719476736, 68719476736) = 68719476736, ceiling(68719476738, 68719476736) = 137438953472, ceiling(-68719476738, 68719476736) = -68719476736
     888ceiling(137438953472, 137438953472) = 137438953472, ceiling(137438953474, 137438953472) = 274877906944, ceiling(-137438953474, 137438953472) = -137438953472
     889ceiling(274877906944, 274877906944) = 274877906944, ceiling(274877906946, 274877906944) = 549755813888, ceiling(-274877906946, 274877906944) = -274877906944
     890ceiling(549755813888, 549755813888) = 549755813888, ceiling(549755813890, 549755813888) = 1099511627776, ceiling(-549755813890, 549755813888) = -549755813888
     891ceiling(1099511627776, 1099511627776) = 1099511627776, ceiling(1099511627778, 1099511627776) = 2199023255552, ceiling(-1099511627778, 1099511627776) = -1099511627776
     892ceiling(2199023255552, 2199023255552) = 2199023255552, ceiling(2199023255554, 2199023255552) = 4398046511104, ceiling(-2199023255554, 2199023255552) = -2199023255552
     893ceiling(4398046511104, 4398046511104) = 4398046511104, ceiling(4398046511106, 4398046511104) = 8796093022208, ceiling(-4398046511106, 4398046511104) = -4398046511104
     894ceiling(8796093022208, 8796093022208) = 8796093022208, ceiling(8796093022210, 8796093022208) = 17592186044416, ceiling(-8796093022210, 8796093022208) = -8796093022208
     895ceiling(17592186044416, 17592186044416) = 17592186044416, ceiling(17592186044418, 17592186044416) = 35184372088832, ceiling(-17592186044418, 17592186044416) = -17592186044416
     896ceiling(35184372088832, 35184372088832) = 35184372088832, ceiling(35184372088834, 35184372088832) = 70368744177664, ceiling(-35184372088834, 35184372088832) = -35184372088832
     897ceiling(70368744177664, 70368744177664) = 70368744177664, ceiling(70368744177666, 70368744177664) = 140737488355328, ceiling(-70368744177666, 70368744177664) = -70368744177664
     898ceiling(140737488355328, 140737488355328) = 140737488355328, ceiling(140737488355330, 140737488355328) = 281474976710656, ceiling(-140737488355330, 140737488355328) = -140737488355328
     899ceiling(281474976710656, 281474976710656) = 281474976710656, ceiling(281474976710658, 281474976710656) = 562949953421312, ceiling(-281474976710658, 281474976710656) = -281474976710656
     900ceiling(562949953421312, 562949953421312) = 562949953421312, ceiling(562949953421314, 562949953421312) = 1125899906842624, ceiling(-562949953421314, 562949953421312) = -562949953421312
     901ceiling(1125899906842624, 1125899906842624) = 1125899906842624, ceiling(1125899906842626, 1125899906842624) = 2251799813685248, ceiling(-1125899906842626, 1125899906842624) = -1125899906842624
     902ceiling(2251799813685248, 2251799813685248) = 2251799813685248, ceiling(2251799813685250, 2251799813685248) = 4503599627370496, ceiling(-2251799813685250, 2251799813685248) = -2251799813685248
     903ceiling(4503599627370496, 4503599627370496) = 4503599627370496, ceiling(4503599627370498, 4503599627370496) = 9007199254740992, ceiling(-4503599627370498, 4503599627370496) = -4503599627370496
     904ceiling(9007199254740992, 9007199254740992) = 9007199254740992, ceiling(9007199254740994, 9007199254740992) = 18014398509481984, ceiling(-9007199254740994, 9007199254740992) = -9007199254740992
     905ceiling(18014398509481984, 18014398509481984) = 18014398509481984, ceiling(18014398509481986, 18014398509481984) = 36028797018963968, ceiling(-18014398509481986, 18014398509481984) = -18014398509481984
     906ceiling(36028797018963968, 36028797018963968) = 36028797018963968, ceiling(36028797018963970, 36028797018963968) = 72057594037927936, ceiling(-36028797018963970, 36028797018963968) = -36028797018963968
     907ceiling(72057594037927936, 72057594037927936) = 72057594037927936, ceiling(72057594037927938, 72057594037927936) = 144115188075855872, ceiling(-72057594037927938, 72057594037927936) = -72057594037927936
     908ceiling(144115188075855872, 144115188075855872) = 144115188075855872, ceiling(144115188075855874, 144115188075855872) = 288230376151711744, ceiling(-144115188075855874, 144115188075855872) = -144115188075855872
     909ceiling(288230376151711744, 288230376151711744) = 288230376151711744, ceiling(288230376151711746, 288230376151711744) = 576460752303423488, ceiling(-288230376151711746, 288230376151711744) = -288230376151711744
     910ceiling(576460752303423488, 576460752303423488) = 576460752303423488, ceiling(576460752303423490, 576460752303423488) = 1152921504606846976, ceiling(-576460752303423490, 576460752303423488) = -576460752303423488
     911ceiling(1152921504606846976, 1152921504606846976) = 1152921504606846976, ceiling(1152921504606846978, 1152921504606846976) = 2305843009213693952, ceiling(-1152921504606846978, 1152921504606846976) = -1152921504606846976
     912ceiling(2305843009213693952, 2305843009213693952) = 2305843009213693952, ceiling(2305843009213693954, 2305843009213693952) = 4611686018427387904, ceiling(-2305843009213693954, 2305843009213693952) = -2305843009213693952
     913ceiling(4611686018427387904, 4611686018427387904) = 4611686018427387904, ceiling(4611686018427387906, 4611686018427387904) = -9223372036854775808, ceiling(-4611686018427387906, 4611686018427387904) = -4611686018427387904
     914ceiling(-9223372036854775808, -9223372036854775808) = -9223372036854775808, ceiling(-9223372036854775806, -9223372036854775808) = 0, ceiling(9223372036854775806, -9223372036854775808) = -9223372036854775808
    915915
    916916unsigned long long int
  • tests/Makefile.am

    r0b0a285 rc84dd61  
    9090        concurrency/clib.c \
    9191        concurrency/unified_locking/mutex_test.hfa \
    92         concurrency/channels/parallel_harness.hfa
     92        concurrency/channels/parallel_harness.hfa \
     93        array-container/dimexpr-match.hfa \
     94        array-container/dimexpr-match-detail.sh
    9395
    9496dist-hook:
     
    111113# '@' => do not echo command (SILENT), '+' => allows recursive make from within python program
    112114all-local : # This name is important to automake and implies the default build target.
    113         @+${TEST_PY} --debug=${debug} --install=${installed} --invariant ${ARCHIVE_ERRORS} ${TIMEOUT} ${GLOBAL_TIMEOUT} ${ARCH} --all
     115        @+${TEST_PY} --debug=${debug} --install=${installed} ${ARCHIVE_ERRORS} ${TIMEOUT} ${GLOBAL_TIMEOUT} ${ARCH} --all
    114116
    115117tests : all-local # synonym
     
    225227        -cp ${test} ${abspath ${@}}
    226228
     229array-container/dimexpr-match-c-ERRS : array-container/dimexpr-match-c.cfa
     230        ${CFACOMPILE_SYNTAX} -DERRS
     231        -cp ${test} ${abspath ${@}}
     232
     233array-container/dimexpr-match-cfa-ERRS : array-container/dimexpr-match-cfa.cfa
     234        ${CFACOMPILE_SYNTAX} -DERRS
     235        -cp ${test} ${abspath ${@}}
     236
    227237alloc-ERROR : alloc.cfa ${CFACCBIN}
    228238        ${CFACOMPILE_SYNTAX} -DERR1
  • tests/collections/vector-demo.cfa

    r0b0a285 rc84dd61  
    143143    assert( v`capacity >  5 && v`length == 5 );
    144144
    145     v[2] = -0.1;  // v is [0.0, 98.6, -0.1, 0.2, 0.3]; iter at -0.1, where only the new memory had that change
     145    v[2] = -0.1f;  // v is [0.0, 98.6, -0.1, 0.2, 0.3]; iter at -0.1, where only the new memory had that change
    146146
    147147    float val3 = iter`val;
  • tests/concurrency/actors/.expect/inherit.txt

    r0b0a285 rc84dd61  
    44A
    55A
     6A
     7A
    68Finished
  • tests/concurrency/actors/dynamic.cfa

    r0b0a285 rc84dd61  
    2828    derived_actor * d_actor = alloc();
    2929    (*d_actor){};
    30     *d_actor << *d_msg;
     30    *d_actor | *d_msg;
    3131    return Delete;
    3232}
     
    5858    derived_actor * d_actor = alloc();
    5959    (*d_actor){};
    60     *d_actor << *d_msg;
     60    *d_actor | *d_msg;
    6161
    6262    printf("stopping\n");
  • tests/concurrency/actors/executor.cfa

    r0b0a285 rc84dd61  
    2828    if ( recs % Batch == 0 ) {
    2929        for ( i; Batch ) {
    30             gstart[sends % Set] << shared_msg;
     30            gstart[sends % Set] | shared_msg;
    3131            sends += 1;
    3232        }
     
    9494
    9595        for ( i; Actors ) {
    96                 actors[i] << shared_msg;
     96                actors[i] | shared_msg;
    9797        } // for
    9898
  • tests/concurrency/actors/inherit.cfa

    r0b0a285 rc84dd61  
    77
    88struct Server { inline actor; };
     9
    910struct Server2 { inline Server; int b; };
     11void ^?{}( Server2 & this ) { mutex(sout) sout | 'A'; }
     12
    1013struct D_msg { int a; inline message; };
    11 struct D_msg2 { inline D_msg; };
    12 
    13 void ^?{}( Server2 & this ) { mutex(sout) sout | 'A'; }
    1414void ?{}( D_msg & this ) { set_allocation( this, Delete ); }
    1515void ^?{}( D_msg & this ) { mutex(sout) sout | 'A'; }
     16
     17struct D_msg2 { inline D_msg; };
    1618
    1719allocation handle() {
     
    3032        D_msg * dm = alloc();
    3133        (*dm){};
    32         D_msg2 dm2;
     34        D_msg2 * dm2 = alloc();
     35        (*dm2){};
    3336        Server2 * s = alloc();
    3437        (*s){};
    3538        Server2 * s2 = alloc();
    3639        (*s2){};
    37         *s << *dm;
    38         *s2 << dm2;
     40        *s | *dm;
     41        *s2 | *dm2;
    3942        stop_actor_system();
    4043    }
     
    4447        D_msg * dm = alloc();
    4548        (*dm){};
    46         D_msg2 dm2;
    47         s[0] << *dm;
    48         s[1] << dm2;
     49        D_msg2 * dm2 = alloc();
     50        (*dm2){};
     51        s[0] | *dm;
     52        s[1] | *dm2;
    4953        stop_actor_system();
    5054    }
  • tests/concurrency/actors/matrix.cfa

    r0b0a285 rc84dd61  
    105105
    106106        for ( unsigned int r = 0; r < xr; r += 1 ) {
    107                 actors[r] << messages[r];
     107                actors[r] | messages[r];
    108108        } // for
    109109
  • tests/concurrency/actors/pingpong.cfa

    r0b0a285 rc84dd61  
    2525    allocation retval = Nodelete;
    2626    if ( msg.count == times ) retval = Finished;
    27     *po << msg;
     27    *po | msg;
    2828    return retval;
    2929}
     
    3535    allocation retval = Nodelete;
    3636    if ( msg.count == times ) retval = Finished;
    37     *pi << msg;
     37    *pi | msg;
    3838    return retval;
    3939}
     
    5353    pi = &pi_actor;
    5454    p_msg m;
    55     pi_actor << m;
     55    pi_actor | m;
    5656    stop_actor_system();
    5757
  • tests/concurrency/actors/poison.cfa

    r0b0a285 rc84dd61  
    1818        Server s[10];
    1919        for ( i; 10 ) {
    20             s[i] << finished_msg;
     20            s[i] | finished_msg;
    2121        }
    2222        stop_actor_system();
     
    2929            Server * s = alloc();
    3030            (*s){};
    31             (*s) << delete_msg;
     31            (*s) | delete_msg;
    3232        }
    3333        stop_actor_system();
     
    3939        Server s[10];
    4040        for ( i; 10 )
    41             s[i] << destroy_msg;
     41            s[i] | destroy_msg;
    4242        stop_actor_system();
    4343        for ( i; 10 )
  • tests/concurrency/actors/static.cfa

    r0b0a285 rc84dd61  
    2525    }
    2626    msg.cnt++;
    27     receiver << msg;
     27    receiver | msg;
    2828    return Nodelete;
    2929}
     
    5555    derived_actor actor;
    5656
    57     actor << msg;
     57    actor | msg;
    5858
    5959    printf("stopping\n");
  • tests/concurrency/actors/types.cfa

    r0b0a285 rc84dd61  
    7272    b.num = 1;
    7373    c.num = 2;
    74     a << b << c;
     74    a | b | c;
    7575    stop_actor_system();
    7676
     
    8080    d_msg d_ac2_msg;
    8181    d_ac2_msg.num = 3;
    82     d_ac2_0 << d_ac2_msg;
    83     d_ac2_1 << d_ac2_msg;
     82    d_ac2_0 | d_ac2_msg;
     83    d_ac2_1 | d_ac2_msg;
    8484    stop_actor_system();
    8585
     
    9393        d_msg d_ac23_msg;
    9494        d_ac23_msg.num = 4;
    95         d_ac3_0 << d_ac23_msg;
    96         d_ac2_2 << d_ac23_msg;
     95        d_ac3_0 | d_ac23_msg;
     96        d_ac2_2 | d_ac23_msg;
    9797        stop_actor_system();
    9898    } // RAII to clean up executor
     
    107107        b1.num = -1;
    108108        c2.num = 5;
    109         a3 << b1 << c2;
     109        a3 | b1 | c2;
    110110        stop_actor_system();
    111111    } // RAII to clean up executor
     
    120120        b1.num = -1;
    121121        c2.num = 5;
    122         a4 << b1 << c2;
     122        a4 | b1 | c2;
    123123        stop_actor_system();
    124124    } // RAII to clean up executor
  • tests/coroutine/devicedriver.cfa

    r0b0a285 rc84dd61  
    1010// Created On       : Sat Mar 16 15:30:34 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Apr 20 09:07:19 2019
    13 // Update Count     : 90
     12// Last Modified On : Sat Jun 17 09:11:56 2023
     13// Update Count     : 94
    1414//
    1515
     
    1818
    1919enum Status { CONT, MSG, ESTX, ELNTH, ECRC };
     20
    2021coroutine Driver {
    2122        Status status;
     
    2324}; // Driver
    2425
    25 void ?{}( Driver & d, char * m ) { d.msg = m; }
    26 Status next( Driver & d, char b ) with( d ) {
    27         byte = b; resume( d ); return status;
     26void ?{}( Driver & d, char * m ) { d.msg = m; }                 // constructor
     27
     28Status next( Driver & d, char b ) with( d ) {                   // called by interrupt handler
     29        byte = b; resume( d ); return status;                           // resume coroutine at last suspend
    2830} // next
    2931
     
    7375          if ( eof( sin ) ) break eof;                                          // eof ?
    7476                choose( next( driver, byte ) ) {                                // analyse character
    75                   case MSG:
    76                         sout | "msg:" | msg;
    77                   case ESTX:
    78                         sout | "STX in message";
    79                   case ELNTH:
    80                         sout | "message too long";
    81                   case ECRC:
    82                         sout | "CRC failure";
    83                   default: ;
     77                  case CONT: ;
     78                  case MSG: sout | "msg:" | msg;
     79                  case ESTX: sout | "STX in message";
     80                  case ELNTH: sout | "message too long";
     81                  case ECRC: sout | "CRC failure";
    8482                } // choose
    8583        } // for
     
    8785
    8886// Local Variables: //
    89 // tab-width: 4 //
    9087// compile-command: "cfa -g -Wall -Wextra devicedriver.cfa" //
    9188// End: //
  • tests/io/manipulatorsInput.cfa

    r0b0a285 rc84dd61  
    77// Created On       : Sat Jun  8 17:58:54 2019
    88// Last Modified By : Peter A. Buhr
    9 // Last Modified On : Wed Jul 15 15:56:03 2020
    10 // Update Count     : 47
     9// Last Modified On : Sat Jun 17 07:56:02 2023
     10// Update Count     : 48
    1111//
    1212
     
    152152                sin | ignore( wdi( 8, ldc ) );                  sout | ldc;
    153153        }
    154 #if defined( __SIZEOF_INT128__ )
     154        #if defined( __SIZEOF_INT128__ )
    155155        {
    156156                int128 val;
     
    160160                }
    161161        }
    162 #endif // __SIZEOF_INT128__
     162        #endif // __SIZEOF_INT128__
    163163} // main
    164164
  • tests/pybin/settings.py

    r0b0a285 rc84dd61  
    141141        all_install  = [Install(o)      for o in list(dict.fromkeys(options.install))]
    142142        archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
    143         invariant    = options.invariant
     143        invariant    = options.no_invariant
    144144        continue_    = options.continue_
    145145        dry_run      = options.dry_run # must be called before tools.config_hash()
  • tests/test.py

    r0b0a285 rc84dd61  
    114114        parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=comma_separated(yes_no), default='no')
    115115        parser.add_argument('--continue', help='When multiple specifications are passed (debug/install/arch), sets whether or not to continue if the last specification failed', type=yes_no, default='yes', dest='continue_')
    116         parser.add_argument('--invariant', help='Tell the compiler to check invariants while running.', action='store_true')
     116        parser.add_argument('--invariant', help='Tell the compiler to check invariants.', action='store_true')
     117        parser.add_argument('--no-invariant', help='Tell the compiler not to check invariants.', action='store_false')
    117118        parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=180)
    118119        parser.add_argument('--global-timeout', help='Maximum cumulative duration in seconds after the ALL tests are considered to have timed out', type=int, default=7200)
Note: See TracChangeset for help on using the changeset viewer.