Changes in / [c84dd61:0b0a285]


Ignore:
Files:
30 deleted
80 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/colby_parsons_MMAth/Makefile

    rc84dd61 r0b0a285  
    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 \
    6652}
    6753
  • doc/theses/colby_parsons_MMAth/benchmarks/actors/cfa/balance.cfa

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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' ))
    169168                    if currBench == Bench.Executor or currBench == Bench.Matrix or currBench == Bench.Balance_One or currBench == Bench.Repeat:
    170169                        plt.yscale("log")
  • doc/theses/colby_parsons_MMAth/benchmarks/channels/plotData.py

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

    rc84dd61 r0b0a285  
    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' ))
    106105                plt.yscale("log")
    107106                plt.xticks(procs)
  • doc/theses/colby_parsons_MMAth/glossary.tex

    rc84dd61 r0b0a285  
    3737\newabbreviation{toctou}{TOCTOU}{\Newterm{time-of-check to time-of-use}}
    3838
    39 \newglossaryentry{actor}{
     39\newglossaryentry{actor}
     40{
    4041name=actor,
    4142description={A basic unit of an actor system that can store local state and send messages to other actors.}
    4243}
    4344
    44 \newglossaryentry{gulp}{
    45 name={gulp},
    46 first={\Newterm{gulp}},
     45\newglossaryentry{gulp}
     46{
     47name=gulp,
    4748description={Move the contents of message queue to a local queue of the executor thread using a single atomic instruction.}
    4849}
    4950
    50 \newglossaryentry{impl_concurrency}{
     51\newglossaryentry{impl_concurrency}
     52{
    5153name=implicit concurrency,
    52 first={\Newterm{implicit concurrency}},
    5354description={A class of concurrency features that abstract away explicit thread synchronization and mutual exclusion.}
    5455}
    5556
    56 \newglossaryentry{actor_model}{
     57\newglossaryentry{actor_model}
     58{
    5759name=actor model,
    58 first={\Newterm{actor model}},
    5960description={A concurrent computation model, where tasks are broken into units of work that are distributed to actors in the form of messages.}
    6061}
    6162
    62 \newglossaryentry{actor_system}{
     63\newglossaryentry{actor_system}
     64{
    6365name=actor system,
    64 first={\Newterm{actor system}},
    6566description={An implementation of the actor model.}
    6667}
    6768
    68 \newglossaryentry{synch_multiplex}{
     69\newglossaryentry{synch_multiplex}
     70{
    6971name=synchronous multiplexing,
    70 first={\Newterm{synchronous multiplexing}},
    7172description={synchronization on some subset of a set of resources.}
    7273}
  • doc/theses/colby_parsons_MMAth/local.bib

    rc84dd61 r0b0a285  
    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 
    109102@misc{go:selectref,
    110103  author = "The Go Programming Language Specification",
  • doc/theses/colby_parsons_MMAth/text/actors.tex

    rc84dd61 r0b0a285  
    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 creation 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 create 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:CFAActor}}.
    24 
    25 \subsection{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:CFAActorSyntax}}.
     24
     25\section{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 \subsection{\CFA Actor System}
     47\section{\CFA Actors}
    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}\label{s:CFAActor}
     94\section{\CFA Actor Syntax}\label{s:CFAActorSyntax}
    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}$
    148149        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}$
    153154        int i;
    154         @inline message;@                                               $\C{// Plan-9 C inheritance}$
    155155};
     156void ?{}( int_msg & this, int i ) { this.i = i; }       $\C{// constructor}$
    156157// behaviours
    157 allocation receive( my_actor &, @str_msg & msg@ ) with(msg) {
    158         sout | "string message \"" | str | "\"";
     158allocation receive( my_actor &, @str_msg & msg@ ) {
     159        sout | "string message \"" | msg.str | "\"";
    159160        return Nodelete;                                                $\C{// actor not finished}$
    160161}
    161 allocation receive( my_actor &, @int_msg & msg@ ) with(msg) {
    162         sout | "integer message" | i;
     162allocation receive( my_actor &, @int_msg & msg@ ) {
     163        sout | "integer message" | msg.i;
    163164        return Nodelete;                                                $\C{// actor not finished}$
    164165}
    165166int main() {
     167        start_actor_system();                                   $\C{// sets up executor}$
     168        my_actor actor;                                                 $\C{// default constructor call}$
    166169        str_msg str_msg{ "Hello World" };               $\C{// constructor call}$
    167170        int_msg int_msg{ 42 };                                  $\C{// constructor call}$
    168         start_actor_system();                                   $\C{// sets up executor}$
    169         my_actor actor;                                                 $\C{// default constructor call}$
    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)}$
     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)}$
    173174        stop_actor_system();                                    $\C{// waits until actors finish}\CRT$
    174175} // deallocate int_msg, str_msg, actor
    175176\end{cfa}
    176177\caption{\CFA Actor Syntax}
    177 \label{f:CFAActor}
    178 \end{figure}
    179 
    180 Figure~\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.
    181 This inheritance style is the Plan-9 C-style inheritance discussed in Section~\ref{s:Inheritance}.
     178\label{f:CFAActorSyntax}
     179\end{figure}
     180
     181Figure~\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.
     182This inheritance style is the Plan-9 C-style nominal inheritance discussed in Section~\ref{s:Inheritance}.
    182183Similarly, 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.
    183 Only @str_msg@ needs a constructor to copy the C string;
    184 @int_msg@ is initialized using its \CFA auto-generated constructors.
     184Both message types have constructors to set the message value.
    185185There are two matching @receive@ (behaviour) routines that process the corresponding typed messages.
    186 Both @receive@ routines use a @with@ clause so message fields are not qualified and return @Nodelete@ indicating the actor is not finished.
    187 Also, all messages are marked with @Nodelete@ as their default allocation state.
    188 The program main begins by creating two messages on the stack.
    189 Then the executor system is started by calling @start_actor_system@.
    190 Now an actor is created on the stack and four messages are sent it using operator @?|?@.
    191 The 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}}.
    192 The call to @stop_actor_system@ blocks the program main until all actors are finished and removed from the actor system.
    193 The program main ends by deleting the actor and two messages from the stack.
     186The program main begins by calling @start_actor_system@ to start the actor implementation, including executor threads to run the actors.
     187An actor and two messages are created on the stack, and four messages are sent to the actor using operator @<<@.
     188The 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}}.
     189The call to @stop_actor_system@ blocks program main until all actors are finished and removed from the actor system.
     190The program main ends by deleting the actor and messages from the stack.
    194191The output for the program is:
    195192\begin{cfa}
     
    240237Note, 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.
    241238
    242 \subsection{Actor Envelopes}\label{s:envelope}
    243 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.
    244 Because a C program manages message lifetime, messages cannot be copied for each send, otherwise who manages the copies.
    245 Therefore, it up to the actor program to manage message life-time across receives.
    246 However, for a message to appear on multiple message queues, it needs an arbitrary number of associated destination behaviours.
    247 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.
    248 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.
    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 
    262239\subsection{Actor System}\label{s:ActorSystem}
    263240The calls to @start_actor_system@, and @stop_actor_system@ mark the start and end of a \CFA actor system.
     
    281258All 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.
    282259
     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
    283269\subsection{Actor Send}\label{s:ActorSend}
    284 All message sends are done using the vertical-bar (bit-or) operator, @?|?@, similar to the syntax of the \CFA stream I/O.
    285 Hence, 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.
    287 Since these routines are not complex, they can be generated using macros that are used to annotate the user-defined actor and message types.
    288 This approach is used in \CFA's intrusive list data structure.
    289 This 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 
     270All message sends are done using the left-shift operator, @<<@, similar to the syntax of \CC's stream output.
    291271As stated, \CFA does not have named inheritance with RTTI.
    292272\CFA does have a preliminary form of virtual routines, but it is not mature enough for use in this work.
    293 Virtuals 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.
    294 Note, 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 
    296 Therefore, 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.
    297 This approach requires no annotation or additional code to be written by users, thus it resolves the maintenance problem.
     273Therefore, 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.)
     275Hence, programmers must write a matching @<<@ routine for each @receive@ routine, which is awkward and generates a maintenance problem.
     276Therefore, 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.
     277Then, \CFA uses the type from the left-hand side of an assignment to select the matching receive routine.
    298278(When the \CFA virtual routines mature, it should be possible to seamlessly transition to it from the template approach.)
    299279
    300 Figure~\ref{f:send_gen} shows the generated send routine for the @int_msg@ receive in Figure~\ref{f:CFAActor}.
    301 Operator @?|?@ has the same parameter signature as the corresponding @receive@ routine and returns an @actor@ so the operator can be cascaded.
    302 The routine sets @rec_fn@ to the matching @receive@ routine using the left-hand type to perform the selection.
    303 Then the routine packages the base and derived actor and message and actor, along with the receive routine into an \hyperref[s:envelope]{envelope}.
    304 Finally, the envelop is added to the executor queue designated by the actor using the executor routine @send@.
     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.
     284An example of a receive routine and its corresponding generated operator routine is shown in Figure~\ref{f:actor_gen}.
     285Notice the parameter signature of @?<<?@ is the same as the @receive@ routine.
     286A @?<<?@ routine is generated per @receive@ routine with a matching signature.
     287The @?<<?@ 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@.
     288The envelope is conceptually "addressed" to a behaviour, which is stored in the envelope as a function pointer to a @receive@ routine.
     289The @?<<?@ routines ensure that messages are sent to the right address, \ie sent to the right @receive@ routine based on actor and message type.
    305290
    306291\begin{figure}
    307292\begin{cfa}
    308 $\LstCommentStyle{// from Figure~\ref{f:CFAActor}}$
    309 struct my_actor { inline actor; };                                              $\C[3.75in]{// actor}$
    310 struct int_msg { inline message; int i; };                              $\C{// message}$
    311 allocation receive( @my_actor &, int_msg & msg@ ) {...} $\C{// receiver}$
    312 
    313 // compiler generated send operator
    314 typedef allocation (*receive_t)( actor &, message & );
    315 actor & ?|?( @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$
     293$\LstCommentStyle{// from Figure~\ref{f:CFAActorSyntax}}$
     294struct my_actor { inline actor; };                                      $\C[3.5in]{// actor}$
     295struct int_msg { inline message; int i; };                      $\C{// message}$
     296void ?{}( int_msg & this, int i ) { this.i = i; }       $\C{// constructor}$
     297allocation 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
     304my_actor & ?<<?( @my_actor & receiver, int_msg & msg@ ) {
     305        send( receiver, (request){ &receiver, &msg, RECEIVER( my_actor, int_msg ) } );
    319306        return receiver;
    320307}
    321308\end{cfa}
    322309\caption{Generated Send Operator}
    323 \label{f:send_gen}
    324 \end{figure}
    325 
    326 \subsection{Actor Termination}\label{s:ActorTerm}
    327 During a message send, the receiving actor and message being sent are stored via pointers in the envelope.
    328 These 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.
    329 After the receive routine is done, the executor must clean up the actor and message according to their allocation status.
    330 If the allocation status is @Delete@ or @Destroy@, the appropriate destructor must be called by the executor.
    331 This 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!
    332 This requires downcasting from the base type to derived type, which requires a virtual system.
    333 Thus, a rudimentary destructor-only virtual system was added to \CFA as part of this work.
    334 This virtual system is used via Plan-9 inheritance of the @virtual_dtor@ type, shown in Figure~\ref{f:VirtDtor}.
    335 The @virtual_dtor@ type maintains a pointer to the start of the object, and a pointer to the correct destructor.
    336 When 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}
    340 struct base_type { inline virtual_dtor; };
    341 struct intermediate_type { inline base_type; };
    342 struct derived_type { inline intermediate_type; };
    343 
    344 int 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 
    358 This virtual destructor system was built for this work, but is general and can be used in any type in \CFA.
    359 Actors 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 
    361 Figure~\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@.
    362 For 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}
    366 message __base_msg_finished $@$= { .allocation_ : Finished }; // no auto-gen constructors
    367 struct __delete_msg_t { inline message; } delete_msg = __base_msg_finished;
    368 struct __destroy_msg_t { inline message; } destroy_msg = __base_msg_finished;
    369 struct __finished_msg_t { inline message; } finished_msg = __base_msg_finished;
    370 
    371 allocation receive( actor & this, __delete_msg_t & msg ) { return Delete; }
    372 allocation receive( actor & this, __destroy_msg_t & msg ) { return Destroy; }
    373 allocation receive( actor & this, __finished_msg_t & msg ) { return Finished; }
    374 \end{cfa}
    375 \caption{Builtin Convenience Messages}
    376 \label{f:ConvenienceMessages}
     310\label{f:actor_gen}
    377311\end{figure}
    378312
     
    385319The goal is to achieve better performance and scalability for certain kinds of actor applications by reducing executor locking.
    386320Note, 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.
     321Work 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}}.
    387322
    388323\begin{figure}
     
    395330
    396331Each executor thread iterates over its own message queues until it finds one with messages.
    397 At 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.
     332At 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.
     333This 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.
     334In detail, an executor thread performs a test-and-gulp, non-atomically checking if a queue is non-empty before gulping it.
     335If a test fails during a message add, the worst-case is cycling through all the message queues.
     336However, the gain is minimizing costly lock acquisitions.
    398337An 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.
    399 This step allows an executor thread to process the local queue without any atomics until the next gulp.
    400 Other executor threads can continue adding to the ends of executor thread's message queues.
    401 In detail, an executor thread performs a test-and-gulp, non-atomically checking if a queue is non-empty, before attempting to gulp it.
    402 If an executor misses an non-empty queue due to a race, it eventually finds the queue after cycling through its message queues.
    403 This approach minimizes costly lock acquisitions.
    404 
    405 Processing 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.
     338
     339Processing a local queue involves removing a unit of work from the queue and executing it.
    406340Since 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.
    407 As each actor is created or terminated by an executor thread, it increments/decrements a global counter.
    408 When 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.
    409 Once a executor threads sees the flag is set it stops running.
    410 After all executors stop, the actor system shutdown is complete.
     341After 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.
     342Once all actors have marked themselves as being finished the executor initiates shutdown by inserting a sentinel value into the message queues.
     343Once a executor threads sees a sentinel it stops running.
     344After all executors stop running the actor system shutdown is complete.
     345
     346\section{Envelopes}\label{s:envelope}
     347As 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.
     348Because a C program manages message lifetime, messages cannot be copied for each send, otherwise who manages the copies.
     349Therefore, it up to the actor program to manage message life-time across receives.
     350However, for a message to appear on multiple message queues, it needs an arbitrary number of link fields.
     351Hence, 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.
     352Managing 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
     366Unfortunately, this frequent allocation of envelopes for each send results in heavy contention on the memory allocator.
     367As such, a way to alleviate contention on the memory allocator would result in a performance improvement.
     368Contention is reduced using a novel data structure, called a \Newterm{copy queue}.
    411369
    412370\subsection{Copy Queue}\label{s:copyQueue}
    413 Unfortunately, the frequent allocation of envelopes for each send results in heavy contention on the memory allocator.
    414 This contention is reduced using a novel data structure, called a \Newterm{copy queue}.
    415371The copy queue is a thin layer over a dynamically sized array that is designed with the envelope use case in mind.
    416 A copy queue supports the typical queue operations of push/pop but in a different way from a typical array-based queue.
    417 
    418 The 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)$.
     372A copy queue supports the typical queue operations of push/pop but in a different way than a typical array based queue.
     373The copy queue is designed to take advantage of the \gls{gulp}ing pattern.
     374As such, the amortized runtime cost of each push/pop operation for the copy queue is $O(1)$.
    419375In 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.
    420376Since 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.
     
    428384For many workload, the copy queues grow in size to facilitate the average number of messages in flight and there is no further dynamic allocations.
    429385One downside of this approach that more storage is allocated than needed, \ie each copy queue is only partially full.
    430 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.
     386Comparatively, 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.
    431387Additionally, 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.
    432388
     
    434390Initially, the memory reclamation na\"ively reclaims one index of the array per \gls{gulp}, if the array size is above a low fixed threshold.
    435391However, this approach has a problem.
    436 The high memory watermark nearly doubled!
    437 The issue is highlighted with an example.
     392The high memory usage watermark nearly doubled!
     393The issue can easily be highlighted with an example.
    438394Assume a fixed throughput workload, where a queue never has more than 19 messages at a time.
    439395If the copy queue starts with a size of 10, it ends up doubling at some point to size 20 to accommodate 19 messages.
    440396However, after 2 gulps and subsequent reclamations the array size is 18.
    441397The next time 19 messages are enqueued, the array size is doubled to 36!
    442 To avoid this issue, a second check is added.
     398To avoid this issue a second check is added.
     399Each copy queue started tracking the utilization of its array size.
    443400Reclamation only occurs if less than half of the array is utilized.
    444 This check achieves a lower total storage and overall memory utilization compared to the non-reclamation copy queues.
    445 However, 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}}.
     401In 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.
     402However, the use of copy queues still incurs a higher memory cost than list-based queueing.
     403With 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}.
    446404
    447405\section{Work Stealing}\label{s:steal}
    448 Work stealing is a scheduling strategy to provide \Newterm{load balance}.
    449 The goal is to increase resource utilization by having idle threads steal work from working threads.
    450 While there are multiple parts in work-stealing scheduler, the two important components are victim selection and the stealing mechanism.
    451 
     406Work stealing is a scheduling strategy that attempts to load balance, and increase resource utilization by having idle threads steal work.
     407There 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
    452410\subsection{Stealing Mechanism}
    453 In work stealing, the stealing worker is called the \Newterm{thief} and the stolen-from worker is called the \Newterm{victim}.
    454 The stealing mechanism presented here differs from existing work-stealing actor-systems because of the message-centric (inverted) actor-system.
    455 Other 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.
    456 As an example, in CAF, the sharded actor queue is a set of double-ended queues (dequeues).
    457 When an actor has messages, it is inserted into a worker's dequeue (ready queue).
     411In 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}.
     412The stealing mechanism presented here differs from existing work stealing actor systems due the inverted actor system.
     413Other 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.
     414As an example, in CAF, the sharded actor queue is a set of double ended queues (dequeues).
     415Whenever an actor is moved to a ready queue, it is inserted into a worker's dequeue.
    458416Workers then consume actors from the dequeue and execute their behaviours.
    459417To steal work, thieves take one or more actors from a victim's dequeue.
    460 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 in a dequeue-based system always results in a potential increase in contention on the dequeues.
    461 This contention can slows down the victim's throughput.
    462 Note, 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 
    464 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}}.
     418This action creates contention on the dequeue, which can slow down the throughput of the victim.
     419The notion of which end of the dequeue is used for stealing, consuming, and inserting is not discussed since it isn't relevant.
     420By 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.
    465421
    466422% C_TODO: maybe insert stealing diagram
    467423
    468 In \CFA, the actor work-stealing implementation is unique because of the message-centric system.
    469 In this system, it is impractical to steal actors because an actor's messages are distributed in temporal order along the message queue.
    470 To 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.
    471 This operation is $O(N)$ with a non-trivial constant.
    472 The 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 
    474 Given queue stealing, the goal is to have a zero-victim-cost stealing mechanism, which does not mean stealing has no cost.
    475 It means work stealing does not affect the performance of the victim worker.
    476 The implication is that thieves cannot contend with a victim, and that a victim should perform no stealing related work unless it becomes a thief.
    477 In theory, this goal is not achievable, but results show the goal is achieved in practice.
    478 
    479 In \CFA's actor system, workers own a set of sharded queues, which they iterate over and gulp.
    480 If a worker has iterated over its message queues twice without finding any work, it tries to steal a queue from another worker.
    481 Stealing a queue is done wait-free with a few atomic instructions that can only create contention with other stealing workers, not the victim.
    482 To steal a queue, a worker does the following:
     424In \CFA, the actor work stealing implementation is unique.
     425While other systems are concerned with stealing actors, the \CFA actor system steals queues.
     426This is a result of \CFA's use of the inverted actor system.
     427The goal of the \CFA actor work stealing mechanism is to have a zero-victim-cost stealing mechanism.
     428This does not means that stealing has no cost.
     429This goal is to ensure that stealing work does not impact the performance of victim workers.
     430This means that thieves can not contend with victims, and that victims should perform no stealing related work unless they become a thief.
     431In theory this goal is not achieved, but results will be presented that show the goal is achieved in practice.
     432In \CFA's actor system workers own a set of sharded queues which they iterate over and gulp.
     433If a worker has iterated over the queues they own twice without finding any work, they try to steal a queue from another worker.
     434Stealing a queue is done wait-free with a few atomic instructions that can only create contention with other stealing workers.
     435To steal a queue a worker does the following:
    483436\begin{enumerate}[topsep=5pt,itemsep=3pt,parsep=0pt]
    484437\item
    485 The thief chooses a victim, which is trivial because all workers are stored in a shared array.
     438The thief chooses a victim.
    486439
    487440\item
    488441The thief starts at a random index in the array of the victim's queues and searches for a candidate queue.
    489 A candidate queue is any non-empty queue not being processed by the victim and not being stolen by another thief.
    490 These rules are not strictly enforced.
    491 A candidate is identified non-atomically, and as such, queues that do not satisfy these rules may be stolen.
    492 However, steals not meeting the rules do not affect correctness and do not constitute failed steals as the queue is always swapped.
    493 
    494 \item
    495 Once a candidate queue is chosen, the thief attempts a wait-free swap of a victim's queue to a random empty thief queue.
    496 If the swap successes, the steal is completed.
    497 If the swap fails, the victim may have been gulping that message queue or another thief must have attempted to steal the victim's queue.
    498 In either case, that message queue is highly likely to be empty.
    499 
    500 \item
    501 Once a thief fails or succeeds in stealing a queue, it iterates over its messages queues again because new messages may have arrived during stealing.
    502 Stealing is only repeated after two consecutive iterations over its owned queues without finding work.
     442A candidate queue is any queue that is not empty, is not being stolen by another thief, and is not being processed by the victim.
     443These are not strictly enforced rules.
     444The candidate is identified non-atomically and as such queues that do not satisfy these rules may be stolen.
     445However, 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
     449Once 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.
     450This swap can fail.
     451If the swap is successful the thief swaps the two queues.
     452If the swap fails, another thief must have attempted to steal one of the two queues being swapped.
     453Failing to steal is good in this case since stealing a queue that was just swapped would likely result in stealing an empty queue.
    503454\end{enumerate}
    504455
     456Once a thief fails or succeeds in stealing a queue, it goes back to its own set of queues and iterates over them again.
     457It will only try to steal again once it has completed two consecutive iterations over its owned queues without finding any work.
    505458The key to the stealing mechanism is that the queues can still be operated on while they are being swapped.
    506 This functionality eliminates any contention among thieves and victims.
    507 
     459This eliminates any contention between thieves and victims.
    508460The first key to this is that actors and workers maintain two distinct arrays of references to queues.
    509461Actors will always receive messages via the same queues.
     
    654606
    655607\subsection{Stealing Guarantees}
     608
     609% C_TODO insert graphs for each proof
    656610Given that the stealing operation can potentially fail, it is important to discuss the guarantees provided by the stealing implementation.
    657611Given 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.
     
    795749Since the @Finished@ allocation status is unused for messages, it is used internally to detect if a message has been sent.
    796750Deallocating 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
    798 As 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.
    799751\end{itemize}
    800752
  • doc/theses/colby_parsons_MMAth/text/mutex_stmt.tex

    rc84dd61 r0b0a285  
    415415\begin{figure}
    416416        \centering
    417     \captionsetup[subfloat]{labelfont=footnotesize,textfont=footnotesize}
    418417        \subfloat[AMD]{
    419418                \resizebox{0.5\textwidth}{!}{\input{figures/nasus_Aggregate_Lock_2.pgf}}
     
    422421                \resizebox{0.5\textwidth}{!}{\input{figures/pyke_Aggregate_Lock_2.pgf}}
    423422        }
    424     \bigskip
    425423
    426424        \subfloat[AMD]{
     
    430428                \resizebox{0.5\textwidth}{!}{\input{figures/pyke_Aggregate_Lock_4.pgf}}
    431429        }
    432     \bigskip
    433430
    434431        \subfloat[AMD]{
  • driver/cfa.cc

    rc84dd61 r0b0a285  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun  9 14:36:41 2023
    13 // Update Count     : 479
     12// Last Modified On : Tue May 30 10:47:52 2023
     13// Update Count     : 478
    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
    337336        #endif // __ARM_ARCH
    338337
  • libcfa/prelude/builtins.c

    rc84dd61 r0b0a285  
    149149
    150150static inline {
    151         int ?\?( int x, unsigned int y ) { __CFA_EXP__(); }
     151        long 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 int ?\?( unsigned int x, unsigned int y ) { __CFA_EXP__(); }
     155        unsigned long 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         int ?\=?( int & x, unsigned int y ) { x = x \ y; return x; }
     178        long 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 int ?\=?( unsigned int & x, unsigned int y ) { x = x \ y; return x; }
     181        unsigned long 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

    rc84dd61 r0b0a285  
    206206_Bool __sync_bool_compare_and_swap(volatile unsigned __int128 *, unsigned __int128, unsigned __int128,...);
    207207#endif
    208 // for all pointer types
    209208forall(T &) _Bool __sync_bool_compare_and_swap(T * volatile *, T *, T*, ...);
    210209
     
    224223unsigned __int128 __sync_val_compare_and_swap(volatile unsigned __int128 *, unsigned __int128, unsigned __int128,...);
    225224#endif
    226 // for all pointer types
    227225forall(T &) T * __sync_val_compare_and_swap(T * volatile *, T *, T*,...);
    228226
     
    328326void __atomic_exchange(volatile unsigned __int128 *, unsigned __int128 *, unsigned __int128 *, int);
    329327#endif
    330 // for all pointer types
    331328forall(T &) T * __atomic_exchange_n(T * volatile *, T *, int);
    332329forall(T &) void __atomic_exchange(T * volatile *, T **, T **, int);
     
    362359void __atomic_load(const volatile unsigned __int128 *, unsigned __int128 *, int);
    363360#endif
    364 // for all pointer types
    365361forall(T &) T * __atomic_load_n(T * const volatile *, int);
    366362forall(T &) void __atomic_load(T * const volatile *, T **, int);
     
    394390_Bool __atomic_compare_exchange   (volatile unsigned __int128 *, unsigned __int128 *, unsigned __int128 *, _Bool, int, int);
    395391#endif
    396 // for all pointer types
    397392forall(T &) _Bool __atomic_compare_exchange_n (T * volatile *, T **, T*, _Bool, int, int);
    398393forall(T &) _Bool __atomic_compare_exchange   (T * volatile *, T **, T**, _Bool, int, int);
     
    428423void __atomic_store(volatile unsigned __int128 *, unsigned __int128 *, int);
    429424#endif
    430 // for all pointer types
    431425forall(T &) void __atomic_store_n(T * volatile *, T *, int);
    432426forall(T &) void __atomic_store(T * volatile *, T **, int);
  • libcfa/src/common.hfa

    rc84dd61 r0b0a285  
    3232} // extern "C"
    3333static inline __attribute__((always_inline)) {
    34         unsigned char abs( signed char v ) { return (int)abs( (int)v ); }
     34        unsigned char abs( signed char v ) { return 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 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; }
    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 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; }
    7575        forall( T | { int ?<?( T, T ); } )                                      // generic
    7676        T min( T v1, T v2 ) { return v1 < v2 ? v1 : v2; }
  • libcfa/src/concurrency/actor.hfa

    rc84dd61 r0b0a285  
    3030#define __DEFAULT_EXECUTOR_BUFSIZE__ 10
    3131
    32 #define __STEAL 1 // workstealing toggle. Disjoint from toggles above
     32#define __STEAL 0 // 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 &, actor **, message **);
     48typedef allocation (*__receive_fn)(actor &, message &);
    4949struct request {
    5050    actor * receiver;
    5151    message * msg;
    5252    __receive_fn fn;
     53    bool stop;
    5354};
    5455
    55 struct a_msg {
    56     int m;
    57 };
    58 static inline void ?{}( request & this ) {}
     56static inline void ?{}( request & this ) { this.stop = true; } // default ctor makes a sentinel
    5957static inline void ?{}( request & this, actor * receiver, message * msg, __receive_fn fn ) {
    6058    this.receiver = receiver;
    6159    this.msg = msg;
    6260    this.fn = fn;
     61    this.stop = false;
    6362}
    6463static inline void ?{}( request & this, request & copy ) {
     
    6665    this.msg = copy.msg;
    6766    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) {
    86     DEBUG_ABORT( count != 0, "Actor system terminated with messages sent but not received\n" );
    87     adelete(buffer);
    88 }
     85static inline void ^?{}( copy_queue & this ) with(this) { adelete(buffer); }
    8986
    9087static inline void insert( copy_queue & this, request & elem ) with(this) {
     
    120117}
    121118
    122 static inline bool is_empty( copy_queue & this ) with(this) { return count == 0; }
     119static inline bool isEmpty( copy_queue & this ) with(this) { return count == 0; }
    123120
    124121struct work_queue {
     
    181178    volatile unsigned long long stamp;
    182179    #ifdef ACTOR_STATS
    183     size_t stolen_from, try_steal, stolen, empty_stolen, failed_swaps, msgs_stolen;
     180    size_t stolen_from, try_steal, stolen, failed_swaps, msgs_stolen;
    184181    unsigned long long processed;
    185182    size_t gulps;
     
    194191    this.gulps = 0;                                 // number of gulps
    195192    this.failed_swaps = 0;                          // steal swap failures
    196     this.empty_stolen = 0;                          // queues empty after steal
    197193    this.msgs_stolen = 0;                           // number of messages stolen
    198194    #endif
     
    214210#ifdef ACTOR_STATS
    215211// aggregate counters for statistics
    216 size_t __total_tries = 0, __total_stolen = 0, __total_workers, __all_gulps = 0, __total_empty_stolen = 0,
     212size_t __total_tries = 0, __total_stolen = 0, __total_workers, __all_gulps = 0,
    217213    __total_failed_swaps = 0, __all_processed = 0, __num_actors_stats = 0, __all_msgs_stolen = 0;
    218214#endif
     
    239235        unsigned int nprocessors, nworkers, nrqueues;   // number of processors/threads/request queues
    240236        bool seperate_clus;                                                             // use same or separate cluster for executor
    241     volatile bool is_shutdown;                      // flag to communicate shutdown to worker threads
    242237}; // executor
    243238
     
    253248    __atomic_add_fetch(&__total_stolen, executor_->w_infos[id].stolen, __ATOMIC_SEQ_CST);
    254249    __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);
    256250
    257251    // per worker steal stats (uncomment alongside the lock above this routine to print)
     
    280274    this.nrqueues = nrqueues;
    281275    this.seperate_clus = seperate_clus;
    282     this.is_shutdown = false;
    283276
    284277    if ( nworkers == nrqueues )
     
    329322
    330323static inline void ^?{}( executor & this ) with(this) {
    331     is_shutdown = true;
     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
    332337
    333338    for ( i; nworkers )
     
    360365    size_t avg_gulps = __all_gulps == 0 ? 0 : __all_processed / __all_gulps;
    361366    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);
    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);
     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);
    364369    size_t avg_steal = __total_stolen == 0 ? 0 : __all_msgs_stolen / __total_stolen;
    365370    printf("\tMessages stolen:\t\t\t%lu\n\tAverage steal size:\t\t\t%lu\n", __all_msgs_stolen, avg_steal);
     
    444449static inline void check_message( message & this ) {
    445450    switch ( this.allocation_ ) {                                               // analyze message status
    446         case Nodelete: CFA_DEBUG( this.allocation_ = Finished ); break;
     451        case Nodelete: CFA_DEBUG(this.allocation_ = Finished); break;
    447452        case Delete: delete( &this ); break;
    448         case Destroy: ^?{}( this ); break;
     453        case Destroy: ^?{}(this); break;
    449454        case Finished: break;
    450455    } // switch
     
    456461static inline void deliver_request( request & this ) {
    457462    DEBUG_ABORT( this.receiver->ticket == (unsigned long int)MAX, "Attempted to send message to deleted/dead actor\n" );
    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 );
     463    this.receiver->allocation_ = this.fn( *this.receiver, *this.msg );
     464    check_message( *this.msg );
     465    check_actor( *this.receiver );
    464466}
    465467
     
    511513        curr_steal_queue = request_queues[ i + vic_start ];
    512514        // avoid empty queues and queues that are being operated on
    513         if ( curr_steal_queue == 0p || curr_steal_queue->being_processed || is_empty( *curr_steal_queue->c_queue ) )
     515        if ( curr_steal_queue == 0p || curr_steal_queue->being_processed || isEmpty( *curr_steal_queue->c_queue ) )
    514516            continue;
    515517
     
    519521            executor_->w_infos[id].msgs_stolen += curr_steal_queue->c_queue->count;
    520522            executor_->w_infos[id].stolen++;
    521             if ( is_empty( *curr_steal_queue->c_queue ) ) executor_->w_infos[id].empty_stolen++;
    522523            // __atomic_add_fetch(&executor_->w_infos[victim_id].stolen_from, 1, __ATOMIC_RELAXED);
    523524            // replaced_queue[swap_idx]++;
     
    559560}
    560561
    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 ( is_empty( *curr_work_queue->c_queue ) ) {
     583        if ( isEmpty( *curr_work_queue->c_queue ) ) {
    584584            #ifdef __STEAL
    585585            empty_count++;
     
    594594        #endif // ACTOR_STATS
    595595        #ifdef __STEAL
    596         if ( is_empty( *current_queue ) ) {
    597             if ( unlikely( no_steal ) ) { CHECK_TERMINATION; continue; }
     596        if ( isEmpty( *current_queue ) ) {
     597            if ( unlikely( no_steal ) ) continue;
    598598            empty_count++;
    599599            if ( empty_count < steal_threshold ) continue;
    600600            empty_count = 0;
    601 
    602             CHECK_TERMINATION; // check for termination
    603601
    604602            __atomic_store_n( &executor_->w_infos[id].stamp, rdtscl(), __ATOMIC_RELAXED );
     
    612610        }
    613611        #endif // __STEAL
    614         while ( ! is_empty( *current_queue ) ) {
     612        while ( ! isEmpty( *current_queue ) ) {
    615613            #ifdef ACTOR_STATS
    616614            executor_->w_infos[id].processed++;
     
    618616            &req = &remove( *current_queue );
    619617            if ( !&req ) continue;
     618            if ( req.stop ) break Exit;
    620619            deliver_request( req );
    621620        }
     
    624623        empty_count = 0; // we found work so reset empty counter
    625624        #endif
    626 
    627         CHECK_TERMINATION;
    628625       
    629626        // potentially reclaim some of the current queue's vector space if it is unused
     
    647644    __all_gulps = 0;
    648645    __total_failed_swaps = 0;
    649     __total_empty_stolen = 0;
    650646    __all_processed = 0;
    651647    __num_actors_stats = 0;
     
    661657}
    662658
    663 static inline void start_actor_system() { start_actor_system( get_proc_count( *active_cluster() ) ); }
     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 ); }
     663static inline void start_actor_system() { start_actor_system( 1 ); }
    664664
    665665static inline void start_actor_system( executor & this ) {
     
    671671
    672672static inline void stop_actor_system() {
    673     park( ); // will be unparked when actor system is finished
     673    park( ); // will receive signal when actor system is finished
    674674
    675675    if ( !__actor_executor_passed ) delete( __actor_executor_ );
  • libcfa/src/concurrency/atomic.hfa

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

    rc84dd61 r0b0a285  
    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;
    201197
    202198        // Total number of idle processors
     
    301297static inline struct cluster   * active_cluster  () { return publicTLS_get( this_processor )->cltr; }
    302298
    303 // gets the number of constructed processors on the cluster
    304 static inline unsigned get_proc_count( cluster & this ) { return this.procs.constructed; }
    305 
    306299// set the number of internal processors
    307300// these processors are in addition to any explicitly declared processors
  • libcfa/src/concurrency/kernel/cluster.hfa

    rc84dd61 r0b0a285  
    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((__readyQ_avg_t)intsc); }
     42static inline __readyQ_avg_t __to_readyQ_avg(unsigned long long intsc) { if(unlikely(0 == intsc)) return 0.0; else return log2(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

    rc84dd61 r0b0a285  
    528528        this.name = name;
    529529        this.cltr = &_cltr;
    530     __atomic_add_fetch( &_cltr.procs.constructed, 1u, __ATOMIC_RELAXED );
    531530        this.rdq.its = 0;
    532531        this.rdq.itr = 0;
     
    596595        __cfadbg_print_safe(runtime_core, "Kernel : core %p signaling termination\n", &this);
    597596
    598     __atomic_sub_fetch( &this.cltr->procs.constructed, 1u, __ATOMIC_RELAXED );
    599 
    600597        __atomic_store_n(&do_terminate, true, __ATOMIC_RELAXED);
    601598        __disable_interrupts_checked();
     
    618615        this.fdw   = 0p;
    619616        this.idle  = 0;
    620     this.constructed = 0;
    621617        this.total = 0;
    622618}
  • libcfa/src/concurrency/locks.hfa

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

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

    rc84dd61 r0b0a285  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jun 15 22:34:31 2023
    13 // Update Count     : 411
     12// Last Modified On : Thu Feb  2 11:25:39 2023
     13// Update Count     : 410
    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 {
     70        trait writeable {
    7171        ostype & ?|?( ostype &, T );
    7272}; // writeable
     
    161161// *********************************** manipulators ***********************************
    162162
    163 struct _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 
    173163forall( T )
    174164struct _Ostream_Manip {
     
    178168        union {
    179169                unsigned char all;
    180                 _Ostream_Flags flags;
     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;
    181179        };
    182180}; // _Ostream_Manip
  • libcfa/src/math.hfa

    rc84dd61 r0b0a285  
    1010// Created On       : Mon Apr 18 23:37:04 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jun 18 08:13:53 2023
    13 // Update Count     : 202
     12// Last Modified On : Sat Oct  8 08:40:42 2022
     13// Update Count     : 136
    1414//
    1515
     
    236236
    237237        return (i << 32) + (sum);
    238 } // log2_u32_32
     238}
    239239
    240240//---------------------- Trigonometric ----------------------
     
    371371
    372372inline __attribute__((always_inline)) static {
    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; }
     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; }
    384383
    385384        // forall( T | { T ?/?( T, T ); T ?*?( T, T ); } )
    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         }
     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 ); *}
    439415
    440416        float floor( float x ) { return floorf( x ); }
  • libcfa/src/stdlib.hfa

    rc84dd61 r0b0a285  
    367367
    368368        char random( void ) { return (unsigned long int)random(); }
    369         char random( char u ) { return (unsigned long int)random( (unsigned long int)u ); } // [0,u)
     369        char random( char u ) { return 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 (long int)random( (long int)u ); } // [0,u]
     372        int random( int u ) { return 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 (unsigned long int)random( (unsigned long int)u ); } // [0,u]
     375        unsigned int random( unsigned int u ) { return 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

    rc84dd61 r0b0a285  
    2525    __virtual_obj_start = &this;
    2626}
    27 static 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
     27static inline void __CFA_dtor_shutdown( virtual_dtor & this ) with(this) {
    2928    if ( __virtual_dtor_ptr ) {
    3029        void (*dtor_ptr)(virtual_dtor &) = __virtual_dtor_ptr;
    3130        __virtual_dtor_ptr = 0p;
    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;
     31        dtor_ptr(*((virtual_dtor *)__virtual_obj_start)); // replace actor with base type
     32        return;
    3533    }
    36     return false;
    3734}
    3835static inline void __CFA_virt_free( virtual_dtor & this ) { free( this.__virtual_obj_start ); }
  • src/AST/Convert.cpp

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

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

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

    rc84dd61 r0b0a285  
    1919
    2020#include "Copy.hpp"
    21 #include <iostream>
    22 #include <algorithm>
    23 
    2421#include "Decl.hpp"
    2522#include "Expr.hpp"
     
    206203                        out.push_back(decl.second);
    207204                }
    208 
    209                 // std::cerr << otypeKey << ' ' << out.size() << std::endl;
    210205        }
    211206
  • src/AST/Type.hpp

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

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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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             //////////////////////////////////////////////////////////////////////
    307225            // The following generates this send message operator routine for all receive(derived_actor &, derived_msg &) functions
    308226            /*
     
    328246            ));
    329247           
    330             // Function type is: allocation (*)( derived_actor &, derived_msg &, actor **, message ** )
     248            // Function type is: allocation (*)( derived_actor &, derived_msg & )
    331249            FunctionType * derivedReceive = new FunctionType();
    332250            derivedReceive->params.push_back( ast::deepCopy( derivedActorRef ) );
    333251            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 ) ) ) );
    336252            derivedReceive->returns.push_back( new EnumInstType( *allocationDecl ) );
    337253
    338             // Generates: allocation (*my_work_fn)( derived_actor &, derived_msg &, actor **, message ** ) = receive;
     254            // Generates: allocation (*my_work_fn)( derived_actor &, derived_msg & ) = receive;
    339255            sendBody->push_back( new DeclStmt(
    340256                decl->location,
     
    343259                    "my_work_fn",
    344260                    new PointerType( derivedReceive ),
    345                     new SingleInit( decl->location, new NameExpr( decl->location, "__CFA_receive_wrap" ) )
     261                    new SingleInit( decl->location, new NameExpr( decl->location, "receive" ) )
    346262                )
    347263            ));
     
    351267            genericReceive->params.push_back( new ReferenceType( new StructInstType( *actorDecl ) ) );
    352268            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 ) ) ) );
    355269            genericReceive->returns.push_back( new EnumInstType( *allocationDecl ) );
    356270
     
    371285            ));
    372286
    373             // Generates: new_req{ (actor *)&receiver, (message *)&msg, fn };
     287            // Generates: new_req{ &receiver, &msg, fn };
    374288            sendBody->push_back( new ExprStmt(
    375289                decl->location,
     
    379293                                        {
    380294                                                new NameExpr( decl->location, "new_req" ),
    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 ),
     295                        new AddressExpr( new NameExpr( decl->location, "receiver" ) ),
     296                        new AddressExpr( new NameExpr( decl->location, "msg" ) ),
    383297                        new NameExpr( decl->location, "fn" )
    384298                                        }
     
    407321            FunctionDecl * sendOperatorFunction = new FunctionDecl(
    408322                decl->location,
    409                 "?|?",
     323                "?<<?",
    410324                {},                     // forall
    411325                {
  • src/GenPoly/SpecializeNew.cpp

    rc84dd61 r0b0a285  
    113113        using namespace ResolvExpr;
    114114        ast::OpenVarSet openVars, closedVars;
    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 );
     115        ast::AssertionSet need, have;
     116        findOpenVars( formalType, openVars, closedVars, need, have, FirstClosed );
     117        findOpenVars( actualType, openVars, closedVars, need, have, FirstOpen );
    119118        for ( const ast::OpenVarSet::value_type & openVar : openVars ) {
    120119                const ast::Type * boundType = subs->lookup( openVar.first );
     
    126125                        if ( closedVars.find( *inst ) == closedVars.end() ) {
    127126                                return true;
    128                         }
    129                         else {
    130                                 assertf(false, "closed: %s", inst->name.c_str());
    131127                        }
    132128                // Otherwise, the variable is bound to a concrete type.
  • src/Parser/DeclarationNode.cc

    rc84dd61 r0b0a285  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 17 14:41:48 2023
    13 // Update Count     : 1405
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Apr 20 11:46:00 2023
     13// Update Count     : 1393
    1414//
    1515
     
    459459        std::vector<ast::ptr<ast::Expr>> exprs;
    460460        buildList( expr, exprs );
    461         newnode->attributes.push_back( new ast::Attribute( *name, std::move( exprs ) ) );
     461        newnode->attributes.push_back(
     462                new ast::Attribute( *name, std::move( exprs ) ) );
    462463        delete name;
    463464        return newnode;
     
    632633                                        dst->basictype = src->basictype;
    633634                                } else if ( src->basictype != DeclarationNode::NoBasicType )
    634                                         SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::basicTypeNames[ dst->basictype ] +
    635                                                                    "\" and \"" + DeclarationNode::basicTypeNames[ src->basictype ] + "\"." );
     635                                        SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::basicTypeNames[ src->basictype ] + " in type: " );
    636636
    637637                                if ( dst->complextype == DeclarationNode::NoComplexType ) {
    638638                                        dst->complextype = src->complextype;
    639639                                } else if ( src->complextype != DeclarationNode::NoComplexType )
    640                                         SemanticError( yylloc, string( "multiple declaration types \"" ) + DeclarationNode::complexTypeNames[ src->complextype ] +
    641                                                                    "\" and \"" + DeclarationNode::complexTypeNames[ src->complextype ] + "\"." );
     640                                        SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::complexTypeNames[ src->complextype ] + " in type: " );
    642641
    643642                                if ( dst->signedness == DeclarationNode::NoSignedness ) {
    644643                                        dst->signedness = src->signedness;
    645644                                } else if ( src->signedness != DeclarationNode::NoSignedness )
    646                                         SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::signednessNames[ dst->signedness ] +
    647                                                                    "\" and \"" + DeclarationNode::signednessNames[ src->signedness ] + "\"." );
     645                                        SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::signednessNames[ src->signedness ] + " in type: " );
    648646
    649647                                if ( dst->length == DeclarationNode::NoLength ) {
     
    652650                                        dst->length = DeclarationNode::LongLong;
    653651                                } else if ( src->length != DeclarationNode::NoLength )
    654                                         SemanticError( yylloc, string( "conflicting type specifier \"" ) + DeclarationNode::lengthNames[ dst->length ] +
    655                                                                    "\" and \"" + DeclarationNode::lengthNames[ src->length ] + "\"." );
     652                                        SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::lengthNames[ src->length ] + " in type: " );
    656653                        } // if
    657654                        break;
     
    721718
    722719DeclarationNode * DeclarationNode::addEnumBase( DeclarationNode * o ) {
    723         if ( o && o->type)  {
     720        if ( o && o -> type)  {
    724721                type->base= o->type;
    725         } // if
     722        }
    726723        delete o;
    727724        return this;
     
    10061003}
    10071004
    1008 // If a typedef wraps an anonymous declaration, name the inner declaration so it has a consistent name across
    1009 // translation units.
     1005// If a typedef wraps an anonymous declaration, name the inner declaration
     1006// so it has a consistent name across translation units.
    10101007static void nameTypedefedDecl(
    10111008                DeclarationNode * innerDecl,
     
    10881085}
    10891086
    1090 void buildList( DeclarationNode * firstNode, std::vector<ast::ptr<ast::Decl>> & outputList ) {
     1087void buildList( DeclarationNode * firstNode,
     1088                std::vector<ast::ptr<ast::Decl>> & outputList ) {
    10911089        SemanticErrorException errors;
    10921090        std::back_insert_iterator<std::vector<ast::ptr<ast::Decl>>> out( outputList );
  • src/Parser/ExpressionNode.cc

    rc84dd61 r0b0a285  
    601601ast::Expr * build_cast( const CodeLocation & location,
    602602                DeclarationNode * decl_node,
    603                 ExpressionNode * expr_node,
    604                 ast::CastExpr::CastKind kind ) {
     603                ExpressionNode * expr_node ) {
    605604        ast::Type * targetType = maybeMoveBuildType( decl_node );
    606605        if ( dynamic_cast<ast::VoidType *>( targetType ) ) {
     
    608607                return new ast::CastExpr( location,
    609608                        maybeMoveBuild( expr_node ),
    610                         ast::ExplicitCast, kind );
     609                        ast::ExplicitCast );
    611610        } else {
    612611                return new ast::CastExpr( location,
    613612                        maybeMoveBuild( expr_node ),
    614613                        targetType,
    615                         ast::ExplicitCast, kind );
     614                        ast::ExplicitCast );
    616615        } // if
    617616} // build_cast
  • src/Parser/ExpressionNode.h

    rc84dd61 r0b0a285  
    6969ast::DimensionExpr * build_dimensionref( const CodeLocation &, const std::string * name );
    7070
    71 ast::Expr * build_cast( const CodeLocation &, DeclarationNode * decl_node, ExpressionNode * expr_node, ast::CastExpr::CastKind kind = ast::CastExpr::Default );
     71ast::Expr * build_cast( const CodeLocation &, DeclarationNode * decl_node, ExpressionNode * expr_node );
    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

    rc84dd61 r0b0a285  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 17 18:53:24 2023
    13 // Update Count     : 6347
     12// Last Modified On : Wed Jun  7 14:32:28 2023
     13// Update Count     : 6341
    1414//
    1515
     
    931931                { $$ = new ExpressionNode( new ast::VirtualCastExpr( yylloc, maybeMoveBuild( $5 ), maybeMoveBuildType( $3 ) ) ); }
    932932        | '(' RETURN type_no_function ')' cast_expression       // CFA
    933                 { $$ = new ExpressionNode( build_cast( yylloc, $3, $5, ast::CastExpr::Return ) ); }
     933                { SemanticError( yylloc, "Return cast is currently unimplemented." ); $$ = nullptr; }
    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->clone(), $4 ) ); }
     1042                { $$ = new ExpressionNode( build_cond( yylloc, $1, $1, $4 ) ); }
    10431043        ;
    10441044
  • src/ResolvExpr/Candidate.hpp

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

    rc84dd61 r0b0a285  
    3838#include "typeops.h"              // for combos
    3939#include "Unify.h"
    40 #include "WidenMode.h"
    4140#include "AST/Expr.hpp"
    4241#include "AST/Node.hpp"
     
    750749                        // attempt to narrow based on expected target type
    751750                        const ast::Type * returnType = funcType->returns.front();
    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                                 }
     751                        if ( ! unify(
     752                                returnType, targetType, funcEnv, funcNeed, funcHave, funcOpen )
     753                        ) {
     754                                // unification failed, do not pursue this candidate
     755                                return;
    767756                        }
    768757                }
     
    782771                                for (size_t i=0; i<nParams; ++i) {
    783772                                        auto obj = funcDecl->params[i].strict_as<ast::ObjectDecl>();
    784                                         if ( !instantiateArgument( location,
     773                                        if (!instantiateArgument( location,
    785774                                                funcType->params[i], obj->init, args, results, genStart, symtab)) return;
    786775                                }
     
    792781                        // matches
    793782                        // no default args for indirect calls
    794                         if ( !instantiateArgument( location,
     783                        if ( ! instantiateArgument( location,
    795784                                param, nullptr, args, results, genStart, symtab ) ) return;
    796785                }
     
    885874
    886875                if ( auto structInst = aggrExpr->result.as< ast::StructInstType >() ) {
    887                         addAggMembers( structInst, aggrExpr, *cand, Cost::unsafe, "" );
     876                        addAggMembers( structInst, aggrExpr, *cand, Cost::safe, "" );
    888877                } else if ( auto unionInst = aggrExpr->result.as< ast::UnionInstType >() ) {
    889                         addAggMembers( unionInst, aggrExpr, *cand, Cost::unsafe, "" );
     878                        addAggMembers( unionInst, aggrExpr, *cand, Cost::safe, "" );
    890879                }
    891880        }
     
    10181007                                if ( auto pointer = dynamic_cast< const ast::PointerType * >( funcResult ) ) {
    10191008                                        if ( auto function = pointer->base.as< ast::FunctionType >() ) {
    1020                                                 // if (!selfFinder.allowVoid && function->returns.empty()) continue;
    10211009                                                CandidateRef newFunc{ new Candidate{ *func } };
    10221010                                                newFunc->expr =
     
    10301018                                        if ( const ast::EqvClass * clz = func->env.lookup( *inst ) ) {
    10311019                                                if ( auto function = clz->bound.as< ast::FunctionType >() ) {
    1032                                                         CandidateRef newFunc( new Candidate( *func ) );
     1020                                                        CandidateRef newFunc{ new Candidate{ *func } };
    10331021                                                        newFunc->expr =
    10341022                                                                referenceToRvalueConversion( newFunc->expr, newFunc->cost );
     
    10721060                if ( found.empty() && ! errors.isEmpty() ) { throw errors; }
    10731061
    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 
    10791062                // Compute conversion costs
    10801063                for ( CandidateRef & withFunc : found ) {
     
    10991082                        if ( cvtCost != Cost::infinity ) {
    11001083                                withFunc->cvtCost = cvtCost;
    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 );
     1084                                candidates.emplace_back( std::move( withFunc ) );
     1085                        }
     1086                }
    11181087                found = std::move( candidates );
    11191088
    11201089                // use a new list so that candidates are not examined by addAnonConversions twice
    1121                 // CandidateList winners = findMinCost( found );
    1122                 // promoteCvtCost( winners );
     1090                CandidateList winners = findMinCost( found );
     1091                promoteCvtCost( winners );
    11231092
    11241093                // function may return a struct/union value, in which case we need to add candidates
    11251094                // for implicit conversions to each of the anonymous members, which must happen after
    11261095                // `findMinCost`, since anon conversions are never the cheapest
    1127                 for ( const CandidateRef & c : found ) {
     1096                for ( const CandidateRef & c : winners ) {
    11281097                        addAnonConversions( c );
    11291098                }
    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 ) {
     1099                spliceBegin( candidates, winners );
     1100
     1101                if ( candidates.empty() && targetType && ! targetType->isVoid() ) {
    11341102                        // If resolution is unsuccessful with a target type, try again without, since it
    11351103                        // will sometimes succeed when it wouldn't with a target type binding.
     
    11721140
    11731141                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                 }
    11841142                finder.find( castExpr->arg, ResolvMode::withAdjustment() );
    11851143
     
    11871145
    11881146                CandidateList matches;
    1189                 Cost minExprCost = Cost::infinity;
    1190                 Cost minCastCost = Cost::infinity;
    11911147                for ( CandidateRef & cand : finder.candidates ) {
    11921148                        ast::AssertionSet need( cand->need.begin(), cand->need.end() ), have;
     
    12201176                                // count one safe conversion for each value that is thrown away
    12211177                                thisCost.incSafe( discardedValues );
    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 );
     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 );
    12491190        }
    12501191
     
    15121453                // candidates for true result
    15131454                CandidateFinder finder2( context, tenv );
    1514                 finder2.allowVoid = true;
    15151455                finder2.find( conditionalExpr->arg2, ResolvMode::withAdjustment() );
    15161456                if ( finder2.candidates.empty() ) return;
     
    15181458                // candidates for false result
    15191459                CandidateFinder finder3( context, tenv );
    1520                 finder3.allowVoid = true;
    15211460                finder3.find( conditionalExpr->arg3, ResolvMode::withAdjustment() );
    15221461                if ( finder3.candidates.empty() ) return;
     
    15851524        void Finder::postvisit( const ast::ConstructorExpr * ctorExpr ) {
    15861525                CandidateFinder finder( context, tenv );
    1587                 finder.allowVoid = true;
    15881526                finder.find( ctorExpr->callExpr, ResolvMode::withoutPrune() );
    15891527                for ( CandidateRef & r : finder.candidates ) {
     
    17021640                        CandidateFinder finder( context, tenv, toType );
    17031641                        finder.find( initExpr->expr, ResolvMode::withAdjustment() );
    1704 
    1705                         Cost minExprCost = Cost::infinity;
    1706                         Cost minCastCost = Cost::infinity;
    17071642                        for ( CandidateRef & cand : finder.candidates ) {
    17081643                                if (reason.code == NotFound) reason.code = NoMatch;
     
    17421677                                        // count one safe conversion for each value that is thrown away
    17431678                                        thisCost.incSafe( discardedValues );
    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                                         }
     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 );
    17621685                                }
    17631686                        }
     
    17651688
    17661689                // select first on argument cost, then conversion cost
    1767                 // CandidateList minArgCost = findMinCost( matches );
    1768                 // promoteCvtCost( minArgCost );
    1769                 // candidates = findMinCost( minArgCost );
    1770                 candidates = std::move(matches);
     1690                CandidateList minArgCost = findMinCost( matches );
     1691                promoteCvtCost( minArgCost );
     1692                candidates = findMinCost( minArgCost );
    17711693        }
    17721694
     
    18341756                        auto found = selected.find( mangleName );
    18351757                        if ( found != selected.end() ) {
    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) ) {
     1758                                if ( newCand->cost < found->second.candidate->cost ) {
    18421759                                        PRINT(
    18431760                                                std::cerr << "cost " << newCand->cost << " beats "
     
    18461763
    18471764                                        found->second = PruneStruct{ newCand };
    1848                                 } else if ( newCand->cost == found->second.candidate->cost && newCand->cvtCost == found->second.candidate->cvtCost ) {
     1765                                } else if ( newCand->cost == found->second.candidate->cost ) {
    18491766                                        // if one of the candidates contains a deleted identifier, can pick the other,
    18501767                                        // since deleted expressions should not be ambiguous if there is another option
     
    19371854        */
    19381855
    1939         // optimization: don't prune for NameExpr since it never has cost
    1940         if ( mode.prune && !dynamic_cast<const ast::NameExpr *>(expr) ) {
     1856        if ( mode.prune ) {
    19411857                // trim candidates to single best one
    19421858                PRINT(
  • src/ResolvExpr/CandidateFinder.hpp

    rc84dd61 r0b0a285  
    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)
    3735        std::set< std::string > otypeKeys;  /// different type may map to same key
    3836
  • src/ResolvExpr/CastCost.cc

    rc84dd61 r0b0a285  
    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                 }
    239236                return Cost::zero;
    240237        } else if ( dynamic_cast< const ast::VoidType * >( dst ) ) {
  • src/ResolvExpr/CommonType.cc

    rc84dd61 r0b0a285  
    697697                        if ( auto basic2 = dynamic_cast< const ast::BasicType * >( type2 ) ) {
    698698                                #warning remove casts when `commonTypes` moved to new AST
    699                                
    700                                 /*
    701699                                ast::BasicType::Kind kind = (ast::BasicType::Kind)(int)commonTypes[ (BasicType::Kind)(int)basic->kind ][ (BasicType::Kind)(int)basic2->kind ];
    702700                                if (
     
    708706                                        result = new ast::BasicType{ kind, basic->qualifiers | basic2->qualifiers };
    709707                                }
    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                                
    722708                        } else if (
    723709                                dynamic_cast< const ast::ZeroType * >( type2 )
     
    726712                                #warning remove casts when `commonTypes` moved to new AST
    727713                                ast::BasicType::Kind kind = (ast::BasicType::Kind)(int)commonTypes[ (BasicType::Kind)(int)basic->kind ][ (BasicType::Kind)(int)ast::BasicType::SignedInt ];
    728                                 /*
    729                                 if ( // xxx - what does qualifier even do here??
    730                                         ( ( basic->qualifiers >= type2->qualifiers )
     714                                if (
     715                                        ( ( kind == basic->kind && basic->qualifiers >= type2->qualifiers )
    731716                                                || widen.first )
    732                                          && ( ( /* kind != basic->kind && basic->qualifiers <= type2->qualifiers )
     717                                        && ( ( kind != basic->kind && basic->qualifiers <= type2->qualifiers )
    733718                                                || widen.second )
    734                                 )
    735                                 */
    736                                 if (widen.second) {
    737                                         result = new ast::BasicType{ basic->kind, basic->qualifiers | type2->qualifiers };
     719                                ) {
     720                                        result = new ast::BasicType{ kind, basic->qualifiers | type2->qualifiers };
    738721                                }
    739722                        } else if ( const ast::EnumInstType * enumInst = dynamic_cast< const ast::EnumInstType * >( type2 ) ) {
     
    763746                                auto entry = open.find( *var );
    764747                                if ( entry != open.end() ) {
    765                                 // if (tenv.lookup(*var)) {
    766748                                        ast::AssertionSet need, have;
    767749                                        if ( ! tenv.bindVar(
  • src/ResolvExpr/ConversionCost.cc

    rc84dd61 r0b0a285  
    702702
    703703        cost = costCalc( refType->base, dst, srcIsLvalue, symtab, env );
    704 
    705         // xxx - should qualifiers be considered in pass-by-value?
    706         /*
    707704        if ( refType->base->qualifiers == dst->qualifiers ) {
    708705                cost.incReference();
     
    712709                cost.incUnsafe();
    713710        }
    714         */
    715         cost.incReference();
    716711}
    717712
     
    797792                        cost.incSign( signMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ] );
    798793                }
    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;
    804794        } else if ( dynamic_cast< const ast::PointerType * >( dst ) ) {
    805795                cost = Cost::zero;
    806796                // +1 for zero_t ->, +1 for disambiguation
    807797                cost.incSafe( maxIntCost + 2 );
    808                 // assuming 0p is supposed to be used for pointers?
    809798        }
    810799}
     
    815804                cost = Cost::zero;
    816805        } else if ( const ast::BasicType * dstAsBasic =
    817                         dynamic_cast< const ast::BasicType * >( dst ) ) {               
     806                        dynamic_cast< const ast::BasicType * >( dst ) ) {
    818807                int tableResult = costMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ];
    819808                if ( -1 == tableResult ) {
     
    824813                        cost.incSign( signMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ] );
    825814                }
    826                
    827                 // cost = Cost::zero;
    828815        }
    829816}
  • src/ResolvExpr/FindOpenVars.cc

    rc84dd61 r0b0a285  
    2121#include "AST/Pass.hpp"
    2222#include "AST/Type.hpp"
    23 #include "AST/TypeEnvironment.hpp"
    2423#include "Common/PassVisitor.h"
    2524#include "SynTree/Declaration.h"  // for TypeDecl, DeclarationWithType (ptr ...
    2625#include "SynTree/Type.h"         // for Type, Type::ForallList, ArrayType
    27 
    28 #include <iostream>
    2926
    3027namespace ResolvExpr {
     
    105102                        ast::AssertionSet & need;
    106103                        ast::AssertionSet & have;
    107                         ast::TypeEnvironment & env;
    108104                        bool nextIsOpen;
    109105
    110106                        FindOpenVars_new(
    111107                                ast::OpenVarSet & o, ast::OpenVarSet & c, ast::AssertionSet & n,
    112                                 ast::AssertionSet & h, ast::TypeEnvironment & env, FirstMode firstIsOpen )
    113                         : open( o ), closed( c ), need( n ), have( h ), env (env), nextIsOpen( firstIsOpen ) {}
     108                                ast::AssertionSet & h, FirstMode firstIsOpen )
     109                        : open( o ), closed( c ), need( n ), have( h ), nextIsOpen( firstIsOpen ) {}
    114110
    115111                        void previsit( const ast::FunctionType * type ) {
    116112                                // mark open/closed variables
    117113                                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 
    124114                                        for ( auto & decl : type->forall ) {
    125115                                                open[ *decl ] = ast::TypeData{ decl->base };
     
    147137        void findOpenVars(
    148138                        const ast::Type * type, ast::OpenVarSet & open, ast::OpenVarSet & closed,
    149                         ast::AssertionSet & need, ast::AssertionSet & have, ast::TypeEnvironment & env, FirstMode firstIsOpen ) {
    150                 ast::Pass< FindOpenVars_new > finder{ open, closed, need, have, env, firstIsOpen };
     139                        ast::AssertionSet & need, ast::AssertionSet & have, FirstMode firstIsOpen ) {
     140                ast::Pass< FindOpenVars_new > finder{ open, closed, need, have, firstIsOpen };
    151141                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                 }
    160142        }
    161143} // namespace ResolvExpr
  • src/ResolvExpr/FindOpenVars.h

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

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

    rc84dd61 r0b0a285  
    1616#include "SatisfyAssertions.hpp"
    1717
    18 #include <iostream>
    1918#include <algorithm>
    2019#include <cassert>
     
    4645#include "SymTab/Mangler.h"
    4746
    48 
    49 
    5047namespace ResolvExpr {
    5148
     
    6865                        ast::AssertionSet && h, ast::AssertionSet && n, ast::OpenVarSet && o, ast::UniqueId rs )
    6966                : cdata( c ), adjType( at ), env( std::move( e ) ), have( std::move( h ) ),
    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                   }
     67                  need( std::move( n ) ), open( std::move( o ) ), resnSlot( rs ) {}
    7568        };
    7669
     
    146139        };
    147140
    148         enum AssertionResult {Fail, Skip, Success} ;
     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        }
    149147
    150148        /// Binds a single assertion, updating satisfaction state
     
    157155                        "Assertion candidate does not have a unique ID: %s", toString( candidate ).c_str() );
    158156
    159                 ast::Expr * varExpr = match.cdata.combine( cand->expr->location, cand->cost );
     157                ast::Expr * varExpr = match.cdata.combine( cand->expr->location, cand->cvtCost );
    160158                varExpr->result = match.adjType;
    161159                if ( match.resnSlot ) { varExpr->inferred.resnSlots().emplace_back( match.resnSlot ); }
     
    167165
    168166        /// Satisfy a single assertion
    169         AssertionResult satisfyAssertion( ast::AssertionList::value_type & assn, SatState & sat, bool skipUnbound = false) {
     167        bool satisfyAssertion( ast::AssertionList::value_type & assn, SatState & sat, bool allowConversion = false, bool skipUnbound = false) {
    170168                // skip unused assertions
    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
     169                if ( ! assn.second.isUsed ) return true;
    175170
    176171                // find candidates that unify with the desired type
    177                 AssnCandidateList matches, inexactMatches;
     172                AssnCandidateList matches;
    178173
    179174                std::vector<ast::SymbolTable::IdData> candidates;
     
    184179                                .strict_as<ast::FunctionType>()->params[0]
    185180                                .strict_as<ast::ReferenceType>()->base;
    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                         }
     181                        sat.cand->env.apply(thisArgType);
    192182
    193183                        std::string otypeKey = "";
    194184                        if (thisArgType.as<ast::PointerType>()) otypeKey = Mangle::Encoding::pointer;
    195185                        else if (!isUnboundType(thisArgType)) otypeKey = Mangle::mangle(thisArgType, Mangle::Type | Mangle::NoGenericParams);
    196                         else if (skipUnbound) return AssertionResult::Skip;
     186                        else if (skipUnbound) return false;
    197187
    198188                        candidates = sat.symtab.specialLookupId(kind, otypeKey);
     
    222212
    223213                        ast::OpenVarSet closed;
    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();
     214                        findOpenVars( toType, newOpen, closed, newNeed, have, FirstClosed );
     215                        findOpenVars( adjType, newOpen, closed, newNeed, have, FirstOpen );
     216                        if ( allowConversion ) {
    244217                                if ( auto c = commonType( toType, adjType, newEnv, newNeed, have, newOpen, WidenMode {true, true} ) ) {
    245218                                        // set up binding slot for recursive assertions
     
    250223                                        }
    251224
    252                                         inexactMatches.emplace_back(
     225                                        matches.emplace_back(
    253226                                                cdata, adjType, std::move( newEnv ), std::move( have ), std::move( newNeed ),
    254227                                                std::move( newOpen ), crntResnSlot );
    255228                                }
    256229                        }
     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                        }
    257244                }
    258245
    259246                // break if no satisfying match
    260                 if ( matches.empty() ) matches = std::move(inexactMatches);
    261                 if ( matches.empty() ) return AssertionResult::Fail;
     247                if ( matches.empty() ) return false;
    262248
    263249                // defer if too many satisfying matches
    264250                if ( matches.size() > 1 ) {
    265251                        sat.deferred.emplace_back( assn.first, assn.second, std::move( matches ) );
    266                         return AssertionResult::Success;
     252                        return true;
    267253                }
    268254
    269255                // otherwise bind unique match in ongoing scope
    270256                AssnCandidate & match = matches.front();
    271                 // addToSymbolTable( match.have, sat.symtab );
     257                addToSymbolTable( match.have, sat.symtab );
    272258                sat.newNeed.insert( match.need.begin(), match.need.end() );
    273259                sat.cand->env = std::move( match.env );
     
    275261
    276262                bindAssertion( assn.first, assn.second, sat.cand, match, sat.inferred );
    277                 return AssertionResult::Success;
     263                return true;
    278264        }
    279265
     
    452438                // for each current mutually-compatible set of assertions
    453439                for ( SatState & sat : sats ) {
     440                        bool allowConversion = false;
    454441                        // stop this branch if a better option is already found
    455442                        auto it = thresholds.find( pruneKey( *sat.cand ) );
     
    460447                        for (unsigned resetCount = 0; ; ++resetCount) {
    461448                                ast::AssertionList next;
     449                                resetTyVarRenaming();
    462450                                // make initial pass at matching assertions
    463451                                for ( auto & assn : sat.need ) {
    464                                         resetTyVarRenaming();
    465452                                        // fail early if any assertion is not satisfiable
    466                                         auto result = satisfyAssertion( assn, sat, !next.empty() );
    467                                         if ( result == AssertionResult::Fail ) {
     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) {
    468463                                                Indenter tabs{ 3 };
    469464                                                std::ostringstream ss;
     
    471466                                                print( ss, *sat.cand, ++tabs );
    472467                                                ss << (tabs-1) << "Could not satisfy assertion:\n";
    473                                                 ast::print( ss, assn.first, tabs );
     468                                                ast::print( ss, next[0].first, tabs );
    474469
    475470                                                errors.emplace_back( ss.str() );
    476471                                                goto nextSat;
    477472                                        }
    478                                         else if ( result == AssertionResult::Skip ) {
    479                                                 next.emplace_back(assn);
    480                                                 // goto nextSat;
    481                                         }
    482                                 }
    483                                 // success
    484                                 if (next.empty()) break;
    485 
     473
     474                                        else {
     475                                                allowConversion = true;
     476                                                continue;
     477                                        }
     478                                }
     479                                allowConversion = false;
    486480                                sat.need = std::move(next);
    487481                        }
     
    537531                                                sat.cand->expr, std::move( compat.env ), std::move( compat.open ),
    538532                                                ast::AssertionSet{} /* need moved into satisfaction state */,
    539                                                 sat.cand->cost );
     533                                                sat.cand->cost, sat.cand->cvtCost );
    540534
    541535                                        ast::AssertionSet nextNewNeed{ sat.newNeed };
     
    550544                                        for ( DeferRef r : compat.assns ) {
    551545                                                AssnCandidate match = r.match;
    552                                                 // addToSymbolTable( match.have, nextSymtab );
     546                                                addToSymbolTable( match.have, nextSymtab );
    553547                                                nextNewNeed.insert( match.need.begin(), match.need.end() );
    554548
  • src/ResolvExpr/Unify.cc

    rc84dd61 r0b0a285  
    160160                env.apply( newSecond );
    161161
    162                 // findOpenVars( newFirst, open, closed, need, have, FirstClosed );
    163                 findOpenVars( newSecond, open, closed, need, have, newEnv, FirstOpen );
     162                findOpenVars( newFirst, open, closed, need, have, FirstClosed );
     163                findOpenVars( newSecond, open, closed, need, have, 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)
    967                                 this->result = otherInst;
     966                        if (otherInst && inst->name == otherInst->name) this->result = otherInst;
    968967                        return otherInst;
    969968                }
     
    10501049
    10511050                void postvisit( const ast::TypeInstType * typeInst ) {
    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;
     1051                        assert( open.find( *typeInst ) == open.end() );
     1052                        handleRefType( typeInst, type2 );
    10571053                }
    10581054
     
    11651161        ) {
    11661162                ast::OpenVarSet closed;
    1167                 // findOpenVars( type1, open, closed, need, have, FirstClosed );
    1168                 findOpenVars( type2, open, closed, need, have, env, FirstOpen );
     1163                findOpenVars( type1, open, closed, need, have, FirstClosed );
     1164                findOpenVars( type2, open, closed, need, have, FirstOpen );
    11691165                return unifyInexact(
    11701166                        type1, type2, env, need, have, open, WidenMode{ true, true }, common );
     
    11831179                        entry1 = var1 ? open.find( *var1 ) : open.end(),
    11841180                        entry2 = var2 ? open.find( *var2 ) : open.end();
    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                 /*
     1181                bool isopen1 = entry1 != open.end();
     1182                bool isopen2 = entry2 != open.end();
     1183
    11911184                if ( isopen1 && isopen2 ) {
    11921185                        if ( entry1->second.kind != entry2->second.kind ) return false;
     
    11971190                        return env.bindVar( var1, type2, entry1->second, need, have, open, widen );
    11981191                } else if ( isopen2 ) {
    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 {
     1192                        return env.bindVar( var2, type1, entry2->second, need, have, open, widen );
     1193                } else {
    12111194                        return ast::Pass<Unify_new>::read(
    12121195                                type1, type2, env, need, have, open, widen );
    12131196                }
    1214                
    12151197        }
    12161198
  • src/SynTree/Expression.cc

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

    rc84dd61 r0b0a285  
    271271        bool isGenerated = true;
    272272
    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 );
     273        CastExpr( Expression * arg, bool isGenerated = true );
     274        CastExpr( Expression * arg, Type * toType, bool isGenerated = true );
    283275        CastExpr( Expression * arg, void * ) = delete; // prevent accidentally passing pointers for isGenerated in the first constructor
    284276        CastExpr( const CastExpr & other );
  • src/Tuples/TupleAssignment.cc

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

    rc84dd61 r0b0a285  
    321321void FuncGenerator::produceDecl( const ast::FunctionDecl * decl ) {
    322322        assert( nullptr != decl->stmts );
    323         assert( decl->type_params.size() == getGenericParams( type ).size() );
    324323
    325324        definitions.push_back( decl );
     
    357356                decl->init = nullptr;
    358357                splice( assertions, decl->assertions );
    359                 oldToNew.emplace( old_param, decl );
     358                oldToNew.emplace( std::make_pair( old_param, decl ) );
    360359                type_params.push_back( decl );
    361360        }
     
    523522        InitTweak::InitExpander_new srcParam( src );
    524523        // Assign to destination.
    525         ast::MemberExpr * dstSelect = new ast::MemberExpr(
     524        ast::Expr * dstSelect = new ast::MemberExpr(
    526525                location,
    527526                field,
     
    575574                }
    576575
    577                 ast::MemberExpr * srcSelect = (srcParam) ? new ast::MemberExpr(
     576                ast::Expr * srcSelect = (srcParam) ? new ast::MemberExpr(
    578577                        location, field, new ast::VariableExpr( location, srcParam )
    579578                ) : nullptr;
  • src/Validate/GenericParameter.cpp

    rc84dd61 r0b0a285  
    120120}
    121121
    122 bool isSizedPolymorphic( const ast::AggregateDecl * decl ) {
    123         for ( const auto & param : decl->params ) {
    124                 if ( param->sized ) return true;
    125         }
    126         return false;
    127 }
    128 
    129 struct ValidateGenericParamsCore :
    130                 public ast::WithCodeLocation, public ast::WithGuards {
    131         // Generic parameter filling and checks:
     122struct ValidateGenericParamsCore : public ast::WithCodeLocation {
    132123        const ast::StructInstType * previsit( const ast::StructInstType * type ) {
    133124                assert( location );
     
    138129                assert( location );
    139130                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                 }
    161131        }
    162132};
  • src/Validate/LinkReferenceToTypes.cpp

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

    rc84dd61 r0b0a285  
    146146
    147147            CompoundStmt * dtorBody = mutate( decl->stmts.get() );
    148             // Adds the following to the start of any actor/message dtor:
     148            // Adds the following to the end of any actor/message dtor:
    149149            //  __CFA_dtor_shutdown( this );
    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             );
     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                        ));
    162160            return;
    163161        }
  • src/main.cc

    rc84dd61 r0b0a285  
    2828#include <list>                             // for list
    2929#include <string>                           // for char_traits, operator<<
     30
     31using namespace std;
    3032
    3133#include "AST/Convert.hpp"
     
    8688#include "Virtual/VirtualDtor.hpp"           // for implementVirtDtors
    8789
    88 using 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( "Hoist Struct", Validate::hoistStruct, transUnit );
    337338                PASS( "Eliminate Typedef", Validate::eliminateTypedef, transUnit );
    338                 PASS( "Hoist Struct", Validate::hoistStruct, transUnit );
    339339                PASS( "Validate Generic Parameters", Validate::fillGenericParameters, transUnit );
    340340                PASS( "Translate Dimensions", Validate::translateDimensionParameters, transUnit );
  • tests/.expect/mathX.arm64.txt

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

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

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

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

    rc84dd61 r0b0a285  
    143143    assert( v`capacity >  5 && v`length == 5 );
    144144
    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
     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
    146146
    147147    float val3 = iter`val;
  • tests/concurrency/actors/.expect/inherit.txt

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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    77
    88struct Server { inline actor; };
     9struct Server2 { inline Server; int b; };
     10struct D_msg { int a; inline message; };
     11struct D_msg2 { inline D_msg; };
    912
    10 struct Server2 { inline Server; int b; };
    1113void ^?{}( Server2 & this ) { mutex(sout) sout | 'A'; }
    12 
    13 struct D_msg { int a; inline message; };
    1414void ?{}( D_msg & this ) { set_allocation( this, Delete ); }
    1515void ^?{}( D_msg & this ) { mutex(sout) sout | 'A'; }
    16 
    17 struct D_msg2 { inline D_msg; };
    1816
    1917allocation handle() {
     
    3230        D_msg * dm = alloc();
    3331        (*dm){};
    34         D_msg2 * dm2 = alloc();
    35         (*dm2){};
     32        D_msg2 dm2;
    3633        Server2 * s = alloc();
    3734        (*s){};
    3835        Server2 * s2 = alloc();
    3936        (*s2){};
    40         *s | *dm;
    41         *s2 | *dm2;
     37        *s << *dm;
     38        *s2 << dm2;
    4239        stop_actor_system();
    4340    }
     
    4744        D_msg * dm = alloc();
    4845        (*dm){};
    49         D_msg2 * dm2 = alloc();
    50         (*dm2){};
    51         s[0] | *dm;
    52         s[1] | *dm2;
     46        D_msg2 dm2;
     47        s[0] << *dm;
     48        s[1] << dm2;
    5349        stop_actor_system();
    5450    }
  • tests/concurrency/actors/matrix.cfa

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    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

    rc84dd61 r0b0a285  
    1010// Created On       : Sat Mar 16 15:30:34 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jun 17 09:11:56 2023
    13 // Update Count     : 94
     12// Last Modified On : Sat Apr 20 09:07:19 2019
     13// Update Count     : 90
    1414//
    1515
     
    1818
    1919enum Status { CONT, MSG, ESTX, ELNTH, ECRC };
    20 
    2120coroutine Driver {
    2221        Status status;
     
    2423}; // Driver
    2524
    26 void ?{}( Driver & d, char * m ) { d.msg = m; }                 // constructor
    27 
    28 Status next( Driver & d, char b ) with( d ) {                   // called by interrupt handler
    29         byte = b; resume( d ); return status;                           // resume coroutine at last suspend
     25void ?{}( Driver & d, char * m ) { d.msg = m; }
     26Status next( Driver & d, char b ) with( d ) {
     27        byte = b; resume( d ); return status;
    3028} // next
    3129
     
    7573          if ( eof( sin ) ) break eof;                                          // eof ?
    7674                choose( next( driver, byte ) ) {                                // analyse character
    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";
     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: ;
    8284                } // choose
    8385        } // for
     
    8587
    8688// Local Variables: //
     89// tab-width: 4 //
    8790// compile-command: "cfa -g -Wall -Wextra devicedriver.cfa" //
    8891// End: //
  • tests/io/manipulatorsInput.cfa

    rc84dd61 r0b0a285  
    77// Created On       : Sat Jun  8 17:58:54 2019
    88// Last Modified By : Peter A. Buhr
    9 // Last Modified On : Sat Jun 17 07:56:02 2023
    10 // Update Count     : 48
     9// Last Modified On : Wed Jul 15 15:56:03 2020
     10// Update Count     : 47
    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

    rc84dd61 r0b0a285  
    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.no_invariant
     143        invariant    = options.invariant
    144144        continue_    = options.continue_
    145145        dry_run      = options.dry_run # must be called before tools.config_hash()
  • tests/test.py

    rc84dd61 r0b0a285  
    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.', action='store_true')
    117         parser.add_argument('--no-invariant', help='Tell the compiler not to check invariants.', action='store_false')
     116        parser.add_argument('--invariant', help='Tell the compiler to check invariants while running.', action='store_true')
    118117        parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=180)
    119118        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.