max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
oeis/295/A295077.asm | neoneye/loda-programs | 11 | 164739 | <filename>oeis/295/A295077.asm
; A295077: a(n) = 2*n*(n-1) + 2^n - 1.
; 0,1,7,19,39,71,123,211,367,655,1203,2267,4359,8503,16747,33187,66015,131615,262755,524971,1049335,2097991,4195227,8389619,16778319,33555631,67110163,134219131,268436967,536872535,1073743563,2147485507,4294969279,8589936703,17179871427,34359740747,68719479255,137438956135,274877909755,549755816851,1099511630895,2199023258831,4398046514547,8796093025819,17592186048199,35184372092791,70368744181803,140737488359651,281474976715167,562949953426015,1125899906847523,2251799813690347,4503599627375799
mov $1,$0
mul $1,$0
mov $2,2
pow $2,$0
sub $0,$1
sub $2,$0
sub $2,$0
mov $0,$2
sub $0,1
|
ordinary/predictor_2.ads | jscparker/math_packages | 30 | 22134 | --
-----------------------------------------------------------------------
-- package Predictor_2, 20th order Predictor-Corrector
-- Copyright (C) 2008-2009 <NAME>.
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-----------------------------------------------------------------------
-- PACKAGE Predictor_2
--
-- 20th order Predictor-Corrector for conservative differential equations.
--
-- The program integrates (d/dt)**2 Y = F (t, Y) where t is the
-- independent variable (e.g. time), vector Y is the
-- dependent variable, and F is some function. Certain higher order
-- equations can be reduced to this form.
--
-- Notice that F in independent of dY/dt.
--
-- NOTES ON USE
--
-- The following version assumes that the Dynamical Variable is
-- a 1 dimensional array of Real numbers.
--
-- The user plugs in the function F(t,Y) as a generic formal function.
-- Even if F is t or Y independent, it must be in the form F(t,Y).
-- The user must do all of the work to convert higher order
-- equations to 2nd order equations.
--
generic
type Real is digits <>;
-- The independent variable. It's called Time
-- throughout the package as though the differential
-- equation dY/dt = F (t, Y) were time dependent.
type Dyn_Index is range <>;
type Dynamical_Variable is array(Dyn_Index) of Real;
-- The dependent variable.
-- We require its exact form here so that some inner loop
-- optimizations can be performed below.
with function F
(Time : Real;
Y : Dynamical_Variable)
return Dynamical_Variable is <>;
-- Defines the equation to be integrated as
-- dY/dt = F (t, Y). Even if the equation is t or Y
-- independent, it must be entered in this form.
with function "*"
(Left : Real;
Right : Dynamical_Variable)
return Dynamical_Variable is <>;
-- Defines multiplication of the independent by the
-- dependent variable. An operation of this sort must exist by
-- definition of the derivative, dY/dt = (Y(t+dt) - Y(t)) / dt,
-- which requires multiplication of the (inverse) independent
-- variable t, by the Dynamical variable Y (the dependent variable).
with function "+"
(Left : Dynamical_Variable;
Right : Dynamical_Variable)
return Dynamical_Variable is <>;
-- Defines summation of the dependent variable. Again, this
-- operation must exist by the definition of the derivative,
-- dY/dt = (Y(t+dt) - Y(t)) / dt = (Y(t+dt) + (-1)*Y(t)) / dt.
with function "-"
(Left : Dynamical_Variable;
Right : Dynamical_Variable)
return Dynamical_Variable is <>;
-- Operation must exist by the definition of the derivative,
-- dY/dt = (Y(t+dt) - Y(t)) / dt
package Predictor_2 is
-- You must init. all elements of array Initial_Y, Initial_deriv_Of_Y.
procedure Integrate
(Final_Y : out Dynamical_Variable;
Final_deriv_Of_Y : out Dynamical_Variable;
Final_Time : in Real;
Initial_Y : in Dynamical_Variable;
Initial_deriv_Of_Y : in Dynamical_Variable;
Initial_Time : in Real;
No_Of_Steps : in Real);
No_Of_Corrector_Evaluate_Iterations : constant Integer := 1;
-- 1 is good here.
Final_Corrector_Desired : constant Boolean := True;
-- True is good here.
Extrapolation_Desired : constant Boolean := True;
end Predictor_2;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1578.asm | ljhsiun2/medusa | 9 | 94966 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1578.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r15
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x19e23, %rsi
lea addresses_normal_ht+0x7d77, %rdi
nop
nop
nop
nop
nop
inc %rax
mov $120, %rcx
rep movsq
nop
nop
nop
inc %r15
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %rbp
push %rdi
push %rdx
// Faulty Load
lea addresses_PSE+0x14bab, %r12
clflush (%r12)
nop
nop
nop
nop
nop
inc %rbp
mov (%r12), %rdi
lea oracles, %rdx
and $0xff, %rdi
shlq $12, %rdi
mov (%rdx,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rbp
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
src/test/ref/typeid-plus-bytes.asm | jbrandwood/kickc | 2 | 98564 | <reponame>jbrandwood/kickc
// Test that plus creates the expected type for all legal combinations of bytes (signed/unsigned - constant/variable)
// Commodore 64 PRG executable file
.file [name="typeid-plus-bytes.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.const TYPEID_CHAR = 1
.const TYPEID_SIGNED_CHAR = 2
.label SCREEN = $400
.label SSCREEN = $400
.segment Code
main: {
// testUnsigned()
jsr testUnsigned
// testUnsignedVals()
jsr testUnsignedVals
// testSigned()
jsr testSigned
// testSignedVals()
jsr testSignedVals
// }
rts
}
testUnsigned: {
// SCREEN[idx++] = typeid(250)
lda #0
sta SCREEN
// SCREEN[idx++] = typeid(ubc1)
lda #TYPEID_CHAR
sta SCREEN+1
// SCREEN[idx++] = typeid(ubv1)
sta SCREEN+2
// SCREEN[idx++] = typeid(120+130)
lda #0
sta SCREEN+3
// SCREEN[idx++] = typeid(ubc1+250)
lda #TYPEID_CHAR
sta SCREEN+4
// SCREEN[idx++] = typeid(250+ubc1)
sta SCREEN+5
// SCREEN[idx++] = typeid(ubv1+250)
sta SCREEN+6
// SCREEN[idx++] = typeid(250+ubv1)
sta SCREEN+7
// SCREEN[idx++] = typeid(ubv1+ubc1)
sta SCREEN+8
// SCREEN[idx++] = typeid(ubc1+ubv1)
sta SCREEN+9
// SCREEN[idx++] = typeid(ubv1+ubv1)
sta SCREEN+$a
// }
rts
}
testUnsignedVals: {
.const ubc1 = $fa
.label ubv1 = 2
// volatile unsigned byte ubv1 = 250
lda #$fa
sta.z ubv1
// SCREEN[idx++] = 250
sta SCREEN+$28
// SCREEN[idx++] = ubc1
lda #ubc1
sta SCREEN+$29
// SCREEN[idx++] = ubv1
lda.z ubv1
sta SCREEN+$2a
// SCREEN[idx++] = 120+130
lda #$78+$82
sta SCREEN+$2b
// SCREEN[idx++] = ubc1+250
lda #ubc1+$fa
sta SCREEN+$2c
// SCREEN[idx++] = 250+ubc1
lda #$fa+ubc1
sta SCREEN+$2d
// ubv1+250
lax.z ubv1
axs #-[$fa]
// SCREEN[idx++] = ubv1+250
stx SCREEN+$2e
// 250+ubv1
lax.z ubv1
axs #-[$fa]
// SCREEN[idx++] = 250+ubv1
stx SCREEN+$2f
// ubv1+ubc1
lda #ubc1
clc
adc.z ubv1
// SCREEN[idx++] = ubv1+ubc1
sta SCREEN+$30
// ubc1+ubv1
lda #ubc1
clc
adc.z ubv1
// SCREEN[idx++] = ubc1+ubv1
sta SCREEN+$31
// ubv1+ubv1
lda.z ubv1
asl
// SCREEN[idx++] = ubv1+ubv1
sta SCREEN+$32
// }
rts
}
testSigned: {
// SCREEN[idx++] = typeid(-120)
lda #0
sta SCREEN+$28*2
// SCREEN[idx++] = typeid(sbc1)
lda #TYPEID_SIGNED_CHAR
sta SCREEN+$28*2+1
// SCREEN[idx++] = typeid(sbv1)
sta SCREEN+$28*2+1+1
// SCREEN[idx++] = typeid(-120+-130)
lda #0
sta SCREEN+$28*2+1+1+1
// SCREEN[idx++] = typeid(sbc1+-120)
lda #TYPEID_SIGNED_CHAR
sta SCREEN+$28*2+1+1+1+1
// SCREEN[idx++] = typeid(-120+sbc1)
sta SCREEN+$28*2+1+1+1+1+1
// SCREEN[idx++] = typeid(sbv1+-120)
sta SCREEN+$28*2+1+1+1+1+1+1
// SCREEN[idx++] = typeid(-120+sbv1)
sta SCREEN+$28*2+1+1+1+1+1+1+1
// SCREEN[idx++] = typeid(sbv1+sbc1)
sta SCREEN+$28*2+1+1+1+1+1+1+1+1
// SCREEN[idx++] = typeid(sbc1+sbv1)
sta SCREEN+$28*2+1+1+1+1+1+1+1+1+1
// SCREEN[idx++] = typeid(sbv1+sbv1)
sta SCREEN+$28*2+1+1+1+1+1+1+1+1+1+1
// }
rts
}
testSignedVals: {
.const sbc1 = -$78
.label sbv1 = 3
// volatile signed byte sbv1 = -120
lda #-$78
sta.z sbv1
// SSCREEN[idx++] = (-120)
sta SSCREEN+$28*3
// SSCREEN[idx++] = (sbc1)
lda #sbc1
sta SSCREEN+$28*3+1
// SSCREEN[idx++] = (sbv1)
lda.z sbv1
sta SSCREEN+$28*3+1+1
// SSCREEN[idx++] = (-70+-50)
lda #-$46+-$32
sta SSCREEN+$28*3+1+1+1
// SSCREEN[idx++] = (sbc1+-120)
lda #sbc1+-$78
sta SSCREEN+$28*3+1+1+1+1
// SSCREEN[idx++] = (-120+sbc1)
lda #-$78+sbc1
sta SSCREEN+$28*3+1+1+1+1+1
// sbv1+-120
lax.z sbv1
axs #-[-$78]
// SSCREEN[idx++] = (sbv1+-120)
stx SSCREEN+$28*3+1+1+1+1+1+1
// -120+sbv1
lax.z sbv1
axs #-[-$78]
// SSCREEN[idx++] = (-120+sbv1)
stx SSCREEN+$28*3+1+1+1+1+1+1+1
// sbv1+sbc1
lda #sbc1
clc
adc.z sbv1
// SSCREEN[idx++] = (sbv1+sbc1)
sta SSCREEN+$28*3+1+1+1+1+1+1+1+1
// sbc1+sbv1
lda #sbc1
clc
adc.z sbv1
// SSCREEN[idx++] = (sbc1+sbv1)
sta SSCREEN+$28*3+1+1+1+1+1+1+1+1+1
// sbv1+sbv1
lda.z sbv1
asl
// SSCREEN[idx++] = (sbv1+sbv1)
sta SSCREEN+$28*3+1+1+1+1+1+1+1+1+1+1
// }
rts
}
|
test/AllTests.agda | jespercockx/agda2hs | 0 | 11764 |
module AllTests where
import Issue14
import Issue65
import Issue73
import Fixities
import LanguageConstructs
import Numbers
import Pragmas
import Sections
import Test
import Tuples
import Where
import TypeSynonyms
import Datatypes
import Records
import DefaultMethods
import Vector
{-# FOREIGN AGDA2HS
import Issue14
import Issue65
import Issue73
import Fixities
import LanguageConstructs
import Numbers
import Pragmas
import Sections
import Test
import Tuples
import Where
import TypeSynonyms
import Datatypes
import Records
import DefaultMethods
import Vector
#-}
|
programs/oeis/025/A025730.asm | jmorken/loda | 1 | 11617 | ; A025730: Index of 8^n within sequence of numbers of form 6^i*8^j.
; 1,3,6,10,15,21,28,37,47,58,70,83,97,113,130,148,167,187,208,231,255,280,306,333,361,391,422,454,487,521,556,592,630,669,709,750,792,835,880,926,973,1021,1070,1120,1172,1225,1279,1334,1390,1447,1506,1566,1627,1689
mov $25,$0
mov $27,$0
add $27,1
lpb $27
clr $0,25
mov $0,$25
sub $27,1
sub $0,$27
mov $22,$0
mov $24,$0
add $24,1
lpb $24
mov $0,$22
sub $24,1
sub $0,$24
mov $18,$0
mov $20,2
lpb $20
sub $20,1
add $0,$20
sub $0,1
mov $1,$0
mul $1,9
mov $8,6
lpb $8
div $1,7
mov $8,3
lpe
div $1,8
mov $21,$20
lpb $21
mov $19,$1
sub $21,1
lpe
lpe
lpb $18
mov $18,0
sub $19,$1
lpe
mov $1,$19
add $1,1
add $23,$1
lpe
add $26,$23
lpe
mov $1,$26
|
audio/sfx/unknown_80ad2.asm | adhi-thirumala/EvoYellow | 16 | 243235 | <filename>audio/sfx/unknown_80ad2.asm<gh_stars>10-100
SFX_80ad2_4_Ch4:
dutycycle 15
unknownsfx0x20 15, 247, 0, 5
unknownsfx0x20 15, 231, 8, 5
unknownsfx0x20 8, 180, 128, 4
unknownsfx0x20 15, 162, 96, 4
endchannel
SFX_80ae5_4_Ch5:
dutycycle 68
unknownsfx0x20 14, 215, 129, 4
unknownsfx0x20 14, 199, 137, 4
unknownsfx0x20 10, 180, 1, 4
unknownsfx0x20 15, 194, 225, 3
endchannel
SFX_80af8_4_Ch7:
unknownnoise0x20 14, 247, 124
unknownnoise0x20 12, 246, 108
unknownnoise0x20 9, 228, 124
unknownnoise0x20 15, 226, 108
endchannel
|
alloy4fun_models/trashltl/models/11/DozGu58fQ7WwSwM9r.als | Kaixi26/org.alloytools.alloy | 0 | 1164 | <gh_stars>0
open main
pred idDozGu58fQ7WwSwM9r_prop12 {
some f: File |eventually always f in Trash
}
pred __repair { idDozGu58fQ7WwSwM9r_prop12 }
check __repair { idDozGu58fQ7WwSwM9r_prop12 <=> prop12o } |
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/s-imagef.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 12322 | <filename>bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/s-imagef.ads
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . I M A G E _ F --
-- --
-- S p e c --
-- --
-- Copyright (C) 2020-2021, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
-- ordinary fixed point types whose Small is the ratio of two Int values, and
-- also for conversion operations required in Text_IO.Fixed_IO for such types.
generic
type Int is range <>;
with procedure Scaled_Divide
(X, Y, Z : Int;
Q, R : out Int;
Round : Boolean);
package System.Image_F is
pragma Pure;
procedure Image_Fixed
(V : Int;
S : in out String;
P : out Natural;
Num : Int;
Den : Int;
For0 : Natural;
Aft0 : Natural);
-- Computes fixed_type'Image (V), where V is the integer value (in units of
-- small) of an ordinary fixed point type with small Num/Den, and stores
-- the result in S (1 .. P), updating P on return. The result is computed
-- according to the rules for image for fixed-point types (RM 3.5(34)).
-- For0 and Aft0 are the values of the Fore and Aft attributes for the
-- fixed point type whose mantissa type is Int and whose small is Num/Den.
-- This function is used only for fixed point whose Small is an integer or
-- its reciprocal (see package System.Image_R for the handling of other
-- ordinary fixed-point types). The caller guarantees that S is long enough
-- to hold the result and has a lower bound of 1.
procedure Set_Image_Fixed
(V : Int;
S : in out String;
P : in out Natural;
Num : Int;
Den : Int;
For0 : Natural;
Aft0 : Natural;
Fore : Natural;
Aft : Natural;
Exp : Natural);
-- Sets the image of V, where V is the integer value (in units of small)
-- of a fixed point type with small Num/Den, starting at S (P + 1) and
-- updating P to point to the last character stored, the caller promises
-- that the buffer is large enough and no check is made. Constraint_Error
-- will not necessarily be raised if this requirement is violated, since
-- it is perfectly valid to compile this unit with checks off. For0 and
-- Aft0 are the values of the Fore and Aft attributes for the fixed point
-- type whose mantissa type is Int and whose small is Num/Den. The Fore,
-- Aft and Exp can be set to any valid values for use by Text_IO.Fixed_IO.
end System.Image_F;
|
programs/oeis/108/A108588.asm | neoneye/loda | 22 | 27221 | <reponame>neoneye/loda<filename>programs/oeis/108/A108588.asm
; A108588: Numbers n such that 10*n + 97 is prime.
; 0,1,3,4,6,7,10,13,16,18,21,22,24,25,27,30,36,37,39,45,46,48,49,51,52,55,58,63,66,69,70,73,76,78,79,81,84,85,87,88,90,99,100,102,109,112,114,118,120,121,123,127,133,135,139,147,150,151,153,154,156,157,160,165,168,169,175,177,178,181,189,190,192,193,199,204,211,214,217,219,220,225,226,228,232,234,235,237,238,246,252,255,256,258,259,261,267,268,270,274
add $0,5
seq $0,102342 ; Numbers k such that 10k + 7 is prime.
sub $0,9
|
grovlin-parser/src/main/antlr/GrovlinLexer.g4 | arturbosch/grovlin | 8 | 870 | lexer grammar GrovlinLexer;
// Whitespace
fragment NL : '\r\n' | '\r' | '\n' ;
WS : ( ' ' | '\t' | NL) -> skip;
// Keywords
DEF : 'def';
VAR : 'var';
VAL : 'val';
HAS : 'has';
TRAIT : 'trait';
OBJECT : 'object';
THIS : 'this';
AS : 'as';
IS : 'is';
EXTENDS : 'extends';
OVERRIDE : 'override';
RETURN : 'return';
IF : 'if';
ELSE : 'else';
ELIF : 'elif';
FOR : 'for';
WHILE : 'while';
// Literals
INTLIT : '0'|[1-9][0-9]* ;
DECLIT : '0'|[1-9][0-9]* '.' [0-9]+ ;
BOOLLIT : 'true' | 'false';
STRINGLIT : '"' StringCharacters* '"' ;
fragment
StringCharacters : StringCharacter+;
fragment
StringCharacter : ~["\\]
| EscapeSequence
;
fragment
EscapeSequence : '\\' [btnfr"'\\];
// Misc
POINT : '.';
COMMA : ',';
SEMICOLON : ':';
LBRACE : '{';
RBRACE : '}';
LPAREN : '(' ;
RPAREN : ')' ;
// Relations
EQUAL : '==' ;
INEQUAL : '!=' ;
LESSEQUAL : '<=' ;
LESS : '<' ;
GREATEREQUAL : '>=' ;
GREATER : '>' ;
// Operators
PLUS : '+' ;
MINUS : '-' ;
MUL : '*' ;
DIV : '/' ;
MOD : '%' ;
ASSIGN : '=' ;
// Bool operators
NOT : '!' ;
OR : '||' ;
AND : '&&' ;
XOR : '^' ;
// Identifiers
TYPEID : [A-Z][A-Za-z]* ;
ID : [_]*[A-Za-z0-9_]+ ;
// Defined Types
INT : 'Int';
DECIMAL : 'Decimal';
BOOL : 'Bool';
STRING : 'String';
|
programs/oeis/079/A079954.asm | karttu/loda | 0 | 85590 | <reponame>karttu/loda
; A079954: Partial sums of A030301.
; 0,1,2,2,2,2,2,3,4,5,6,7,8,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165
mov $2,$0
mov $5,$0
lpb $2,1
mov $0,$5
sub $2,1
sub $0,$2
mov $3,3
lpb $0,1
sub $0,1
div $0,2
mod $3,3
mul $3,3
fac $3
lpe
div $3,5
add $4,5
div $6,4
add $6,1
sub $6,$3
mul $6,2
mul $4,$6
div $4,10
add $1,$4
lpe
|
oeis/228/A228959.asm | neoneye/loda-programs | 11 | 245960 | <gh_stars>10-100
; A228959: Total sum of squared lengths of ascending runs in all permutations of [n].
; 0,1,6,32,186,1222,9086,75882,705298,7231862,81160422,990024466,13047411482,184788881838,2799459801742,45178128866282,773829771302946,14021761172671462,267991492197471158,5388234382450264002,113692608262971520042,2512031106415692960926,58003383664797648021342,1397067908734351170753178,35041391836280554488371762,913828846573417021966681302,24742195328235324724825782406,694570697430168785719981975922,20190859387943546508350699152698,607078438187428643479715186407822
sub $1,$0
lpb $0
add $2,1
mul $1,$2
add $1,$0
add $1,$0
sub $0,1
lpe
mov $0,$1
|
libsrc/_DEVELOPMENT/stdio/c/sdcc_iy/funlockfile_fastcall.asm | jpoikela/z88dk | 640 | 104473 |
; void funlockfile_fastcall(FILE *file)
SECTION code_clib
SECTION code_stdio
PUBLIC _funlockfile_fastcall
EXTERN asm_funlockfile
_funlockfile_fastcall:
push hl
pop ix
jp asm_funlockfile
|
agda-stdlib/src/Data/List/Extrema/Core.agda | DreamLinuxer/popl21-artifact | 5 | 9703 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Core lemmas needed to make list argmin/max functions work
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary using (Trans; TotalOrder; Setoid)
module Data.List.Extrema.Core
{b ℓ₁ ℓ₂} (totalOrder : TotalOrder b ℓ₁ ℓ₂) where
open import Algebra.Core
open import Algebra.Definitions
import Algebra.Construct.NaturalChoice.Min as Min
import Algebra.Construct.NaturalChoice.Max as Max
open import Data.Product using (_×_; _,_)
open import Data.Sum.Base using (_⊎_; inj₁; inj₂)
open import Level using (Level)
open import Relation.Binary.PropositionalEquality using (_≡_)
open import Algebra.Construct.LiftedChoice
open TotalOrder totalOrder renaming (Carrier to B)
open import Relation.Binary.Construct.NonStrictToStrict _≈_ _≤_
using (_<_; <-≤-trans; ≤-<-trans)
------------------------------------------------------------------------
-- Setup
-- open NonStrictToStrict totalOrder using (_<_; ≤-<-trans; <-≤-trans)
open Max totalOrder
open Min totalOrder
private
variable
a : Level
A : Set a
<-transʳ : Trans _≤_ _<_ _<_
<-transʳ = ≤-<-trans trans antisym ≤-respˡ-≈
<-transˡ : Trans _<_ _≤_ _<_
<-transˡ = <-≤-trans Eq.sym trans antisym ≤-respʳ-≈
module _ (f : A → B) where
lemma₁ : ∀ {x y v} → f x ≤ v → f x ⊓ f y ≈ f y → f y ≤ v
lemma₁ fx≤v fx⊓fy≈fy = trans (x⊓y≈y⇒y≤x fx⊓fy≈fy) fx≤v
lemma₂ : ∀ {x y v} → f y ≤ v → f x ⊓ f y ≈ f x → f x ≤ v
lemma₂ fy≤v fx⊓fy≈fx = trans (x⊓y≈x⇒x≤y fx⊓fy≈fx) fy≤v
lemma₃ : ∀ {x y v} → f x < v → f x ⊓ f y ≈ f y → f y < v
lemma₃ fx<v fx⊓fy≈fy = <-transʳ (x⊓y≈y⇒y≤x fx⊓fy≈fy) fx<v
lemma₄ : ∀ {x y v} → f y < v → f x ⊓ f y ≈ f x → f x < v
lemma₄ fx<v fx⊓fy≈fy = <-transʳ (x⊓y≈x⇒x≤y fx⊓fy≈fy) fx<v
------------------------------------------------------------------------
-- Definition of lifted max and min
⊓ᴸ : (A → B) → Op₂ A
⊓ᴸ = Lift _≈_ _⊓_ ⊓-sel
⊔ᴸ : (A → B) → Op₂ A
⊔ᴸ = Lift _≈_ _⊔_ ⊔-sel
------------------------------------------------------------------------
-- Properties of ⊓ᴸ
⊓ᴸ-sel : ∀ f → Selective {A = A} _≡_ (⊓ᴸ f)
⊓ᴸ-sel f = sel-≡ ⊓-isSelectiveMagma f
⊓ᴸ-presᵒ-≤v : ∀ f {v} (x y : A) → f x ≤ v ⊎ f y ≤ v → f (⊓ᴸ f x y) ≤ v
⊓ᴸ-presᵒ-≤v f = preservesᵒ ⊓-isSelectiveMagma f (lemma₁ f) (lemma₂ f)
⊓ᴸ-presᵒ-<v : ∀ f {v} (x y : A) → f x < v ⊎ f y < v → f (⊓ᴸ f x y) < v
⊓ᴸ-presᵒ-<v f = preservesᵒ ⊓-isSelectiveMagma f (lemma₃ f) (lemma₄ f)
⊓ᴸ-presᵇ-v≤ : ∀ f {v} {x y : A} → v ≤ f x → v ≤ f y → v ≤ f (⊓ᴸ f x y)
⊓ᴸ-presᵇ-v≤ f {v} = preservesᵇ ⊓-isSelectiveMagma {P = λ x → v ≤ f x} f
⊓ᴸ-presᵇ-v< : ∀ f {v} {x y : A} → v < f x → v < f y → v < f (⊓ᴸ f x y)
⊓ᴸ-presᵇ-v< f {v} = preservesᵇ ⊓-isSelectiveMagma {P = λ x → v < f x} f
⊓ᴸ-forcesᵇ-v≤ : ∀ f {v} (x y : A) → v ≤ f (⊓ᴸ f x y) → v ≤ f x × v ≤ f y
⊓ᴸ-forcesᵇ-v≤ f {v} = forcesᵇ ⊓-isSelectiveMagma f
(λ v≤fx fx⊓fy≈fx → trans v≤fx (x⊓y≈x⇒x≤y fx⊓fy≈fx))
(λ v≤fy fx⊓fy≈fy → trans v≤fy (x⊓y≈y⇒y≤x fx⊓fy≈fy))
------------------------------------------------------------------------
-- Properties of ⊔ᴸ
⊔ᴸ-sel : ∀ f → Selective {A = A} _≡_ (⊔ᴸ f)
⊔ᴸ-sel f = sel-≡ ⊔-isSelectiveMagma f
⊔ᴸ-presᵒ-v≤ : ∀ f {v} (x y : A) → v ≤ f x ⊎ v ≤ f y → v ≤ f (⊔ᴸ f x y)
⊔ᴸ-presᵒ-v≤ f {v} = preservesᵒ ⊔-isSelectiveMagma f
(λ v≤fx fx⊔fy≈fy → trans v≤fx (x⊔y≈y⇒x≤y fx⊔fy≈fy))
(λ v≤fy fx⊔fy≈fx → trans v≤fy (x⊔y≈x⇒y≤x fx⊔fy≈fx))
⊔ᴸ-presᵒ-v< : ∀ f {v} (x y : A) → v < f x ⊎ v < f y → v < f (⊔ᴸ f x y)
⊔ᴸ-presᵒ-v< f {v} = preservesᵒ ⊔-isSelectiveMagma f
(λ v<fx fx⊔fy≈fy → <-transˡ v<fx (x⊔y≈y⇒x≤y fx⊔fy≈fy))
(λ v<fy fx⊔fy≈fx → <-transˡ v<fy (x⊔y≈x⇒y≤x fx⊔fy≈fx))
⊔ᴸ-presᵇ-≤v : ∀ f {v} {x y : A} → f x ≤ v → f y ≤ v → f (⊔ᴸ f x y) ≤ v
⊔ᴸ-presᵇ-≤v f {v} = preservesᵇ ⊔-isSelectiveMagma {P = λ x → f x ≤ v} f
⊔ᴸ-presᵇ-<v : ∀ f {v} {x y : A} → f x < v → f y < v → f (⊔ᴸ f x y) < v
⊔ᴸ-presᵇ-<v f {v} = preservesᵇ ⊔-isSelectiveMagma {P = λ x → f x < v} f
⊔ᴸ-forcesᵇ-≤v : ∀ f {v} (x y : A) → f (⊔ᴸ f x y) ≤ v → f x ≤ v × f y ≤ v
⊔ᴸ-forcesᵇ-≤v f {v} = forcesᵇ ⊔-isSelectiveMagma f
(λ fx≤v fx⊔fy≈fx → trans (x⊔y≈x⇒y≤x fx⊔fy≈fx) fx≤v)
(λ fy≤v fx⊔fy≈fy → trans (x⊔y≈y⇒x≤y fx⊔fy≈fy) fy≤v)
|
oeis/027/A027966.asm | neoneye/loda-programs | 11 | 1587 | <gh_stars>10-100
; A027966: T(n, 2*n-4), T given by A027960.
; 1,4,11,26,54,101,174,281,431,634,901,1244,1676,2211,2864,3651,4589,5696,6991,8494,10226,12209,14466,17021,19899,23126,26729,30736,35176,40079,45476,51399,57881,64956,72659,81026,90094,99901,110486,121889,134151,147314,161421,176516,192644,209851,228184,247691,268421,290424,313751,338454,364586,392201,421354,452101,484499,518606,554481,592184,631776,673319,716876,762511,810289,860276,912539,967146,1024166,1083669,1145726,1210409,1277791,1347946,1420949,1496876,1575804,1657811,1742976,1831379
mov $1,$0
add $0,4
bin $0,$1
pow $1,2
sub $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1769.asm | ljhsiun2/medusa | 9 | 14316 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x1d05a, %rcx
nop
nop
nop
nop
xor %rsi, %rsi
mov (%rcx), %r12d
nop
cmp %r10, %r10
lea addresses_UC_ht+0x19f02, %rdx
nop
nop
and $11165, %r13
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
movups %xmm4, (%rdx)
nop
nop
nop
nop
nop
inc %rcx
lea addresses_WC_ht+0x1ea32, %r13
nop
nop
nop
nop
nop
add %rbp, %rbp
mov $0x6162636465666768, %rdx
movq %rdx, %xmm4
vmovups %ymm4, (%r13)
nop
cmp $44728, %rdx
lea addresses_D_ht+0xad02, %rsi
lea addresses_A_ht+0x19402, %rdi
nop
nop
add $4544, %r13
mov $41, %rcx
rep movsl
nop
nop
nop
sub $55482, %rsi
lea addresses_D_ht+0xaee2, %rsi
lea addresses_A_ht+0xee5d, %rdi
clflush (%rdi)
nop
nop
nop
sub $30967, %r13
mov $108, %rcx
rep movsq
nop
nop
nop
nop
nop
sub $15490, %rdx
lea addresses_normal_ht+0x17e2, %rbp
nop
nop
nop
sub $48188, %r13
movups (%rbp), %xmm0
vpextrq $0, %xmm0, %rdi
nop
nop
nop
nop
cmp %r13, %r13
lea addresses_A_ht+0xfba2, %rsi
lea addresses_normal_ht+0x5388, %rdi
nop
nop
nop
nop
nop
and $10444, %r13
mov $36, %rcx
rep movsb
nop
nop
nop
nop
nop
and $55898, %rdx
lea addresses_A_ht+0x164b2, %rsi
lea addresses_UC_ht+0x6882, %rdi
clflush (%rdi)
nop
sub %r12, %r12
mov $69, %rcx
rep movsl
nop
xor %r13, %r13
lea addresses_WC_ht+0x51a2, %rdx
nop
nop
nop
nop
dec %rsi
mov $0x6162636465666768, %r13
movq %r13, (%rdx)
nop
nop
cmp %rsi, %rsi
lea addresses_A_ht+0xfe02, %rsi
lea addresses_D_ht+0xf402, %rdi
clflush (%rdi)
nop
sub $3005, %r13
mov $31, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %r12
lea addresses_normal_ht+0x17302, %rbp
nop
nop
nop
xor %rdi, %rdi
movw $0x6162, (%rbp)
nop
nop
nop
add %rcx, %rcx
lea addresses_UC_ht+0x15402, %rsi
lea addresses_D_ht+0x3402, %rdi
sub %rbp, %rbp
mov $117, %rcx
rep movsw
xor %rcx, %rcx
lea addresses_WT_ht+0x6852, %rsi
lea addresses_UC_ht+0x9e02, %rdi
nop
nop
dec %r10
mov $1, %rcx
rep movsl
nop
nop
nop
nop
nop
sub $38978, %rbp
lea addresses_normal_ht+0x2fec, %rsi
nop
nop
nop
nop
cmp %rbp, %rbp
movb (%rsi), %cl
nop
nop
nop
nop
nop
sub %r12, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %rax
push %rbx
push %rsi
// Store
lea addresses_PSE+0x1c442, %r10
clflush (%r10)
nop
nop
nop
nop
sub $61439, %rsi
mov $0x5152535455565758, %rax
movq %rax, (%r10)
nop
nop
cmp %rax, %rax
// Faulty Load
lea addresses_UC+0x12802, %r10
xor $19438, %rbx
mov (%r10), %esi
lea oracles, %r13
and $0xff, %rsi
shlq $12, %rsi
mov (%r13,%rsi,1), %rsi
pop %rsi
pop %rbx
pop %rax
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': True, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': True}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
Cats/Util/SetoidReasoning.agda | alessio-b-zak/cats | 0 | 13271 | module Cats.Util.SetoidReasoning where
open import Relation.Binary.SetoidReasoning public
open import Relation.Binary using (Setoid)
open import Relation.Binary.EqReasoning as EqR using (_IsRelatedTo_)
infixr 2 _≡⟨⟩_
_≡⟨⟩_ : ∀ {c l} {S : Setoid c l} → ∀ x {y} → _IsRelatedTo_ S x y → _IsRelatedTo_ S x y
_≡⟨⟩_ {S = S} = EqR._≡⟨⟩_ S
triangle : ∀ {l l′} (S : Setoid l l′) →
let open Setoid S in
∀ m {x y}
→ x ≈ m
→ y ≈ m
→ x ≈ y
triangle S m x≈m y≈m = trans x≈m (sym y≈m)
where
open Setoid S
|
src/fot/FOTC/Data/Conat/Type.agda | asr/fotc | 11 | 12679 | ------------------------------------------------------------------------------
-- The FOTC co-inductive natural numbers type
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- N.B. This module is re-exported by FOTC.Data.Conat.
-- Adapted from (Sander 1992).
module FOTC.Data.Conat.Type where
open import FOTC.Base
------------------------------------------------------------------------------
-- The FOTC co-inductive natural numbers type (co-inductive predicate
-- for total co-inductive natural)
-- Functional for the NatF predicate.
-- NatF : (D → Set) → D → Set
-- NatF A n = n = zero ∨ (∃[ n' ] n = succ n' ∧ A n')
-- Conat is the greatest fixed-point of NatF (by Conat-out and
-- Conat-coind).
postulate Conat : D → Set
-- Conat is a post-fixed point of NatF, i.e.
--
-- Conat ≤ NatF Conat.
postulate
Conat-out : ∀ {n} → Conat n → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ Conat n')
{-# ATP axiom Conat-out #-}
-- Conat is the greatest post-fixed point of NatF, i.e.
--
-- ∀ A. A ≤ NatF A ⇒ A ≤ Conat.
--
-- N.B. This is an axiom schema. Because in the automatic proofs we
-- *must* use an instance, we do not add this postulate as an ATP
-- axiom.
postulate
Conat-coind :
(A : D → Set) →
-- A is post-fixed point of NatF.
(∀ {n} → A n → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n')) →
-- Conat is greater than A.
∀ {n} → A n → Conat n
------------------------------------------------------------------------------
-- References
--
-- Sander, <NAME>. (1992). A Logic of Functional Programs with an
-- Application to Concurrency. PhD thesis. Department of Computer
-- Sciences: Chalmers University of Technology and University of
-- Gothenburg.
|
programs/oeis/132/A132123.asm | karttu/loda | 0 | 169359 | <reponame>karttu/loda<gh_stars>0
; A132123: a(n) = n * (2*n + 1) * (6*n^2 + 4*n + 1) / 3.
; 0,11,110,469,1356,3135,6266,11305,18904,29811,44870,65021,91300,124839,166866,218705,281776,357595,447774,554021,678140,822031,987690,1177209,1392776,1636675,1911286,2219085,2562644,2944631,3367810,3835041,4349280,4913579,5531086,6205045,6938796,7735775,8599514,9533641,10541880,11628051,12796070,14049949,15393796,16831815,18368306,20007665,21754384,23613051,25588350,27685061,29908060,32262319,34752906,37384985,40163816,43094755,46183254,49434861,52855220,56450071,60225250,64186689,68340416,72692555,77249326,82017045,87002124,92211071,97650490,103327081,109247640,115419059,121848326,128542525,135508836,142754535,150286994,158113681,166242160,174680091,183435230,192515429,201928636,211682895,221786346,232247225,243073864,254274691,265858230,277833101,290208020,302991799,316193346,329821665,343885856,358395115,373358734,388786101,404686700,421070111,437946010,455324169,473214456,491626835,510571366,530058205,550097604,570699911,591875570,613635121,635989200,658948539,682523966,706726405,731566876,757056495,783206474,810028121,837532840,865732131,894637590,924260909,954613876,985708375,1017556386,1050169985,1083561344,1117742731,1152726510,1188525141,1225151180,1262617279,1300936186,1340120745,1380183896,1421138675,1462998214,1505775741,1549484580,1594138151,1639749970,1686333649,1733902896,1782471515,1832053406,1882662565,1934313084,1987019151,2040795050,2095655161,2151613960,2208686019,2266886006,2326228685,2386728916,2448401655,2511261954,2575324961,2640605920,2707120171,2774883150,2843910389,2914217516,2985820255,3058734426,3132975945,3208560824,3285505171,3363825190,3443537181,3524657540,3607202759,3691189426,3776634225,3863553936,3951965435,4041885694,4133331781,4226320860,4320870191,4416997130,4514719129,4614053736,4715018595,4817631446,4921910125,5027872564,5135536791,5244920930,5356043201,5468921920,5583575499,5700022446,5818281365,5938370956,6060310015,6184117434,6309812201,6437413400,6566940211,6698411910,6831847869,6967267556,7104690535,7244136466,7385625105,7529176304,7674810011,7822546270,7972405221,8124407100,8278572239,8434921066,8593474105,8754251976,8917275395,9082565174,9250142221,9420027540,9592242231,9766807490,9943744609,10123074976,10304820075,10489001486,10675640885,10864760044,11056380831,11250525210,11447215241,11646473080,11848320979,12052781286,12259876445,12469628996,12682061575,12897196914,13115057841,13335667280,13559048251,13785223870,14014217349,14246051996,14480751215,14718338506,14958837465,15202271784,15448665251
mov $2,$0
mul $0,2
lpb $0,1
add $2,$0
sub $0,1
add $3,$2
add $1,$3
add $2,$0
lpe
|
wof/lcs/base/1F8.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 16 | <filename>wof/lcs/base/1F8.asm
copyright zengfr site:http://github.com/zengfr/romhack
012A70 clr.b ($1f8,A5) [base+1DC]
012A74 clr.b ($200,A5)
012B0E bne $12b30
01A610 dbra D1, $1a60e
copyright zengfr site:http://github.com/zengfr/romhack
|
source/nodes/program-nodes-terminate_alternative_statements.ads | reznikmm/gela | 0 | 20722 | <filename>source/nodes/program-nodes-terminate_alternative_statements.ads
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Terminate_Alternative_Statements;
with Program.Element_Visitors;
package Program.Nodes.Terminate_Alternative_Statements is
pragma Preelaborate;
type Terminate_Alternative_Statement is
new Program.Nodes.Node
and Program.Elements.Terminate_Alternative_Statements
.Terminate_Alternative_Statement
and Program.Elements.Terminate_Alternative_Statements
.Terminate_Alternative_Statement_Text
with private;
function Create
(Terminate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Terminate_Alternative_Statement;
type Implicit_Terminate_Alternative_Statement is
new Program.Nodes.Node
and Program.Elements.Terminate_Alternative_Statements
.Terminate_Alternative_Statement
with private;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Terminate_Alternative_Statement
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Terminate_Alternative_Statement is
abstract new Program.Nodes.Node
and Program.Elements.Terminate_Alternative_Statements
.Terminate_Alternative_Statement
with null record;
procedure Initialize
(Self : in out Base_Terminate_Alternative_Statement'Class);
overriding procedure Visit
(Self : not null access Base_Terminate_Alternative_Statement;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Is_Terminate_Alternative_Statement
(Self : Base_Terminate_Alternative_Statement)
return Boolean;
overriding function Is_Statement
(Self : Base_Terminate_Alternative_Statement)
return Boolean;
type Terminate_Alternative_Statement is
new Base_Terminate_Alternative_Statement
and Program.Elements.Terminate_Alternative_Statements
.Terminate_Alternative_Statement_Text
with record
Terminate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Terminate_Alternative_Statement_Text
(Self : in out Terminate_Alternative_Statement)
return Program.Elements.Terminate_Alternative_Statements
.Terminate_Alternative_Statement_Text_Access;
overriding function Terminate_Token
(Self : Terminate_Alternative_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Semicolon_Token
(Self : Terminate_Alternative_Statement)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Terminate_Alternative_Statement is
new Base_Terminate_Alternative_Statement
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Terminate_Alternative_Statement_Text
(Self : in out Implicit_Terminate_Alternative_Statement)
return Program.Elements.Terminate_Alternative_Statements
.Terminate_Alternative_Statement_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Terminate_Alternative_Statement)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Terminate_Alternative_Statement)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Terminate_Alternative_Statement)
return Boolean;
end Program.Nodes.Terminate_Alternative_Statements;
|
gcc-gcc-7_3_0-release/gcc/ada/a-cbhama.adb | best08618/asylo | 7 | 16278 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . B O U N D E D _ H A S H E D _ M A P S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by <NAME>. --
------------------------------------------------------------------------------
with Ada.Containers.Hash_Tables.Generic_Bounded_Operations;
pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Operations);
with Ada.Containers.Hash_Tables.Generic_Bounded_Keys;
pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Bounded_Keys);
with Ada.Containers.Helpers; use Ada.Containers.Helpers;
with Ada.Containers.Prime_Numbers; use Ada.Containers.Prime_Numbers;
with System; use type System.Address;
package body Ada.Containers.Bounded_Hashed_Maps is
pragma Warnings (Off, "variable ""Busy*"" is not referenced");
pragma Warnings (Off, "variable ""Lock*"" is not referenced");
-- See comment in Ada.Containers.Helpers
-----------------------
-- Local Subprograms --
-----------------------
function Equivalent_Key_Node
(Key : Key_Type;
Node : Node_Type) return Boolean;
pragma Inline (Equivalent_Key_Node);
function Hash_Node (Node : Node_Type) return Hash_Type;
pragma Inline (Hash_Node);
function Next (Node : Node_Type) return Count_Type;
pragma Inline (Next);
procedure Set_Next (Node : in out Node_Type; Next : Count_Type);
pragma Inline (Set_Next);
function Vet (Position : Cursor) return Boolean;
--------------------------
-- Local Instantiations --
--------------------------
package HT_Ops is new Hash_Tables.Generic_Bounded_Operations
(HT_Types => HT_Types,
Hash_Node => Hash_Node,
Next => Next,
Set_Next => Set_Next);
package Key_Ops is new Hash_Tables.Generic_Bounded_Keys
(HT_Types => HT_Types,
Next => Next,
Set_Next => Set_Next,
Key_Type => Key_Type,
Hash => Hash,
Equivalent_Keys => Equivalent_Key_Node);
---------
-- "=" --
---------
function "=" (Left, Right : Map) return Boolean is
function Find_Equal_Key
(R_HT : Hash_Table_Type'Class;
L_Node : Node_Type) return Boolean;
function Is_Equal is new HT_Ops.Generic_Equal (Find_Equal_Key);
--------------------
-- Find_Equal_Key --
--------------------
function Find_Equal_Key
(R_HT : Hash_Table_Type'Class;
L_Node : Node_Type) return Boolean
is
R_Index : constant Hash_Type := Key_Ops.Index (R_HT, L_Node.Key);
R_Node : Count_Type := R_HT.Buckets (R_Index);
begin
while R_Node /= 0 loop
if Equivalent_Keys (L_Node.Key, R_HT.Nodes (R_Node).Key) then
return L_Node.Element = R_HT.Nodes (R_Node).Element;
end if;
R_Node := R_HT.Nodes (R_Node).Next;
end loop;
return False;
end Find_Equal_Key;
-- Start of processing for "="
begin
return Is_Equal (Left, Right);
end "=";
------------
-- Assign --
------------
procedure Assign (Target : in out Map; Source : Map) is
procedure Insert_Element (Source_Node : Count_Type);
procedure Insert_Elements is
new HT_Ops.Generic_Iteration (Insert_Element);
--------------------
-- Insert_Element --
--------------------
procedure Insert_Element (Source_Node : Count_Type) is
N : Node_Type renames Source.Nodes (Source_Node);
C : Cursor;
B : Boolean;
begin
Insert (Target, N.Key, N.Element, C, B);
pragma Assert (B);
end Insert_Element;
-- Start of processing for Assign
begin
if Target'Address = Source'Address then
return;
end if;
if Checks and then Target.Capacity < Source.Length then
raise Capacity_Error
with "Target capacity is less than Source length";
end if;
HT_Ops.Clear (Target);
Insert_Elements (Source);
end Assign;
--------------
-- Capacity --
--------------
function Capacity (Container : Map) return Count_Type is
begin
return Container.Capacity;
end Capacity;
-----------
-- Clear --
-----------
procedure Clear (Container : in out Map) is
begin
HT_Ops.Clear (Container);
end Clear;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased Map;
Position : Cursor) return Constant_Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with
"Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong map";
end if;
pragma Assert (Vet (Position),
"Position cursor in Constant_Reference is bad");
declare
N : Node_Type renames Container.Nodes (Position.Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Constant_Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Constant_Reference;
function Constant_Reference
(Container : aliased Map;
Key : Key_Type) return Constant_Reference_Type
is
Node : constant Count_Type :=
Key_Ops.Find (Container'Unrestricted_Access.all, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with "key not in map";
end if;
declare
N : Node_Type renames Container.Nodes (Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Constant_Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Constant_Reference;
--------------
-- Contains --
--------------
function Contains (Container : Map; Key : Key_Type) return Boolean is
begin
return Find (Container, Key) /= No_Element;
end Contains;
----------
-- Copy --
----------
function Copy
(Source : Map;
Capacity : Count_Type := 0;
Modulus : Hash_Type := 0) return Map
is
C : Count_Type;
M : Hash_Type;
begin
if Capacity = 0 then
C := Source.Length;
elsif Capacity >= Source.Length then
C := Capacity;
elsif Checks then
raise Capacity_Error with "Capacity value too small";
end if;
if Modulus = 0 then
M := Default_Modulus (C);
else
M := Modulus;
end if;
return Target : Map (Capacity => C, Modulus => M) do
Assign (Target => Target, Source => Source);
end return;
end Copy;
---------------------
-- Default_Modulus --
---------------------
function Default_Modulus (Capacity : Count_Type) return Hash_Type is
begin
return To_Prime (Capacity);
end Default_Modulus;
------------
-- Delete --
------------
procedure Delete (Container : in out Map; Key : Key_Type) is
X : Count_Type;
begin
Key_Ops.Delete_Key_Sans_Free (Container, Key, X);
if Checks and then X = 0 then
raise Constraint_Error with "attempt to delete key not in map";
end if;
HT_Ops.Free (Container, X);
end Delete;
procedure Delete (Container : in out Map; Position : in out Cursor) is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor of Delete equals No_Element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor of Delete designates wrong map";
end if;
TC_Check (Container.TC);
pragma Assert (Vet (Position), "bad cursor in Delete");
HT_Ops.Delete_Node_Sans_Free (Container, Position.Node);
HT_Ops.Free (Container, Position.Node);
Position := No_Element;
end Delete;
-------------
-- Element --
-------------
function Element (Container : Map; Key : Key_Type) return Element_Type is
Node : constant Count_Type :=
Key_Ops.Find (Container'Unrestricted_Access.all, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with
"no element available because key not in map";
end if;
return Container.Nodes (Node).Element;
end Element;
function Element (Position : Cursor) return Element_Type is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor of function Element equals No_Element";
end if;
pragma Assert (Vet (Position), "bad cursor in function Element");
return Position.Container.Nodes (Position.Node).Element;
end Element;
-------------------------
-- Equivalent_Key_Node --
-------------------------
function Equivalent_Key_Node
(Key : Key_Type;
Node : Node_Type) return Boolean is
begin
return Equivalent_Keys (Key, Node.Key);
end Equivalent_Key_Node;
---------------------
-- Equivalent_Keys --
---------------------
function Equivalent_Keys (Left, Right : Cursor)
return Boolean is
begin
if Checks and then Left.Node = 0 then
raise Constraint_Error with
"Left cursor of Equivalent_Keys equals No_Element";
end if;
if Checks and then Right.Node = 0 then
raise Constraint_Error with
"Right cursor of Equivalent_Keys equals No_Element";
end if;
pragma Assert (Vet (Left), "Left cursor of Equivalent_Keys is bad");
pragma Assert (Vet (Right), "Right cursor of Equivalent_Keys is bad");
declare
LN : Node_Type renames Left.Container.Nodes (Left.Node);
RN : Node_Type renames Right.Container.Nodes (Right.Node);
begin
return Equivalent_Keys (LN.Key, RN.Key);
end;
end Equivalent_Keys;
function Equivalent_Keys (Left : Cursor; Right : Key_Type) return Boolean is
begin
if Checks and then Left.Node = 0 then
raise Constraint_Error with
"Left cursor of Equivalent_Keys equals No_Element";
end if;
pragma Assert (Vet (Left), "Left cursor in Equivalent_Keys is bad");
declare
LN : Node_Type renames Left.Container.Nodes (Left.Node);
begin
return Equivalent_Keys (LN.Key, Right);
end;
end Equivalent_Keys;
function Equivalent_Keys (Left : Key_Type; Right : Cursor) return Boolean is
begin
if Checks and then Right.Node = 0 then
raise Constraint_Error with
"Right cursor of Equivalent_Keys equals No_Element";
end if;
pragma Assert (Vet (Right), "Right cursor of Equivalent_Keys is bad");
declare
RN : Node_Type renames Right.Container.Nodes (Right.Node);
begin
return Equivalent_Keys (Left, RN.Key);
end;
end Equivalent_Keys;
-------------
-- Exclude --
-------------
procedure Exclude (Container : in out Map; Key : Key_Type) is
X : Count_Type;
begin
Key_Ops.Delete_Key_Sans_Free (Container, Key, X);
HT_Ops.Free (Container, X);
end Exclude;
--------------
-- Finalize --
--------------
procedure Finalize (Object : in out Iterator) is
begin
if Object.Container /= null then
Unbusy (Object.Container.TC);
end if;
end Finalize;
----------
-- Find --
----------
function Find (Container : Map; Key : Key_Type) return Cursor is
Node : constant Count_Type :=
Key_Ops.Find (Container'Unrestricted_Access.all, Key);
begin
if Node = 0 then
return No_Element;
else
return Cursor'(Container'Unrestricted_Access, Node);
end if;
end Find;
-----------
-- First --
-----------
function First (Container : Map) return Cursor is
Node : constant Count_Type := HT_Ops.First (Container);
begin
if Node = 0 then
return No_Element;
else
return Cursor'(Container'Unrestricted_Access, Node);
end if;
end First;
function First (Object : Iterator) return Cursor is
begin
return Object.Container.First;
end First;
------------------------
-- Get_Element_Access --
------------------------
function Get_Element_Access
(Position : Cursor) return not null Element_Access is
begin
return Position.Container.Nodes (Position.Node).Element'Access;
end Get_Element_Access;
-----------------
-- Has_Element --
-----------------
function Has_Element (Position : Cursor) return Boolean is
begin
pragma Assert (Vet (Position), "bad cursor in Has_Element");
return Position.Node /= 0;
end Has_Element;
---------------
-- Hash_Node --
---------------
function Hash_Node (Node : Node_Type) return Hash_Type is
begin
return Hash (Node.Key);
end Hash_Node;
-------------
-- Include --
-------------
procedure Include
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type)
is
Position : Cursor;
Inserted : Boolean;
begin
Insert (Container, Key, New_Item, Position, Inserted);
if not Inserted then
TE_Check (Container.TC);
declare
N : Node_Type renames Container.Nodes (Position.Node);
begin
N.Key := Key;
N.Element := New_Item;
end;
end if;
end Include;
------------
-- Insert --
------------
procedure Insert
(Container : in out Map;
Key : Key_Type;
Position : out Cursor;
Inserted : out Boolean)
is
procedure Assign_Key (Node : in out Node_Type);
pragma Inline (Assign_Key);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Local_Insert is
new Key_Ops.Generic_Conditional_Insert (New_Node);
procedure Allocate is
new HT_Ops.Generic_Allocate (Assign_Key);
-----------------
-- Assign_Key --
-----------------
procedure Assign_Key (Node : in out Node_Type) is
New_Item : Element_Type;
pragma Unmodified (New_Item);
-- Default-initialized element (ok to reference, see below)
begin
Node.Key := Key;
-- There is no explicit element provided, but in an instance the
-- element type may be a scalar with a Default_Value aspect, or a
-- composite type with such a scalar component, or components with
-- default initialization, so insert a possibly initialized element
-- under the given key.
Node.Element := New_Item;
end Assign_Key;
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Container, Result);
return Result;
end New_Node;
-- Start of processing for Insert
begin
-- The buckets array length is specified by the user as a discriminant
-- of the container type, so it is possible for the buckets array to
-- have a length of zero. We must check for this case specifically, in
-- order to prevent divide-by-zero errors later, when we compute the
-- buckets array index value for a key, given its hash value.
if Checks and then Container.Buckets'Length = 0 then
raise Capacity_Error with "No capacity for insertion";
end if;
Local_Insert (Container, Key, Position.Node, Inserted);
Position.Container := Container'Unchecked_Access;
end Insert;
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean)
is
procedure Assign_Key (Node : in out Node_Type);
pragma Inline (Assign_Key);
function New_Node return Count_Type;
pragma Inline (New_Node);
procedure Local_Insert is
new Key_Ops.Generic_Conditional_Insert (New_Node);
procedure Allocate is
new HT_Ops.Generic_Allocate (Assign_Key);
-----------------
-- Assign_Key --
-----------------
procedure Assign_Key (Node : in out Node_Type) is
begin
Node.Key := Key;
Node.Element := New_Item;
end Assign_Key;
--------------
-- New_Node --
--------------
function New_Node return Count_Type is
Result : Count_Type;
begin
Allocate (Container, Result);
return Result;
end New_Node;
-- Start of processing for Insert
begin
-- The buckets array length is specified by the user as a discriminant
-- of the container type, so it is possible for the buckets array to
-- have a length of zero. We must check for this case specifically, in
-- order to prevent divide-by-zero errors later, when we compute the
-- buckets array index value for a key, given its hash value.
if Checks and then Container.Buckets'Length = 0 then
raise Capacity_Error with "No capacity for insertion";
end if;
Local_Insert (Container, Key, Position.Node, Inserted);
Position.Container := Container'Unchecked_Access;
end Insert;
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type)
is
Position : Cursor;
pragma Unreferenced (Position);
Inserted : Boolean;
begin
Insert (Container, Key, New_Item, Position, Inserted);
if Checks and then not Inserted then
raise Constraint_Error with
"attempt to insert key already in map";
end if;
end Insert;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Map) return Boolean is
begin
return Container.Length = 0;
end Is_Empty;
-------------
-- Iterate --
-------------
procedure Iterate
(Container : Map;
Process : not null access procedure (Position : Cursor))
is
procedure Process_Node (Node : Count_Type);
pragma Inline (Process_Node);
procedure Local_Iterate is new HT_Ops.Generic_Iteration (Process_Node);
------------------
-- Process_Node --
------------------
procedure Process_Node (Node : Count_Type) is
begin
Process (Cursor'(Container'Unrestricted_Access, Node));
end Process_Node;
Busy : With_Busy (Container.TC'Unrestricted_Access);
-- Start of processing for Iterate
begin
Local_Iterate (Container);
end Iterate;
function Iterate
(Container : Map) return Map_Iterator_Interfaces.Forward_Iterator'Class
is
begin
return It : constant Iterator :=
(Limited_Controlled with
Container => Container'Unrestricted_Access)
do
Busy (Container.TC'Unrestricted_Access.all);
end return;
end Iterate;
---------
-- Key --
---------
function Key (Position : Cursor) return Key_Type is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor of function Key equals No_Element";
end if;
pragma Assert (Vet (Position), "bad cursor in function Key");
return Position.Container.Nodes (Position.Node).Key;
end Key;
------------
-- Length --
------------
function Length (Container : Map) return Count_Type is
begin
return Container.Length;
end Length;
----------
-- Move --
----------
procedure Move
(Target : in out Map;
Source : in out Map)
is
begin
if Target'Address = Source'Address then
return;
end if;
TC_Check (Source.TC);
Target.Assign (Source);
Source.Clear;
end Move;
----------
-- Next --
----------
function Next (Node : Node_Type) return Count_Type is
begin
return Node.Next;
end Next;
function Next (Position : Cursor) return Cursor is
begin
if Position.Node = 0 then
return No_Element;
end if;
pragma Assert (Vet (Position), "bad cursor in function Next");
declare
M : Map renames Position.Container.all;
Node : constant Count_Type := HT_Ops.Next (M, Position.Node);
begin
if Node = 0 then
return No_Element;
else
return Cursor'(Position.Container, Node);
end if;
end;
end Next;
procedure Next (Position : in out Cursor) is
begin
Position := Next (Position);
end Next;
function Next
(Object : Iterator;
Position : Cursor) return Cursor
is
begin
if Position.Container = null then
return No_Element;
end if;
if Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Next designates wrong map";
end if;
return Next (Position);
end Next;
----------------------
-- Pseudo_Reference --
----------------------
function Pseudo_Reference
(Container : aliased Map'Class) return Reference_Control_Type
is
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Reference_Control_Type := (Controlled with TC) do
Lock (TC.all);
end return;
end Pseudo_Reference;
-------------------
-- Query_Element --
-------------------
procedure Query_Element
(Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : Element_Type))
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor of Query_Element equals No_Element";
end if;
pragma Assert (Vet (Position), "bad cursor in Query_Element");
declare
M : Map renames Position.Container.all;
N : Node_Type renames M.Nodes (Position.Node);
Lock : With_Lock (M.TC'Unrestricted_Access);
begin
Process (N.Key, N.Element);
end;
end Query_Element;
----------
-- Read --
----------
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Map)
is
function Read_Node
(Stream : not null access Root_Stream_Type'Class) return Count_Type;
-- pragma Inline (Read_Node); ???
procedure Read_Nodes is new HT_Ops.Generic_Read (Read_Node);
---------------
-- Read_Node --
---------------
function Read_Node
(Stream : not null access Root_Stream_Type'Class) return Count_Type
is
procedure Read_Element (Node : in out Node_Type);
-- pragma Inline (Read_Element); ???
procedure Allocate is
new HT_Ops.Generic_Allocate (Read_Element);
procedure Read_Element (Node : in out Node_Type) is
begin
Key_Type'Read (Stream, Node.Key);
Element_Type'Read (Stream, Node.Element);
end Read_Element;
Node : Count_Type;
-- Start of processing for Read_Node
begin
Allocate (Container, Node);
return Node;
end Read_Node;
-- Start of processing for Read
begin
Read_Nodes (Stream, Container);
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Cursor)
is
begin
raise Program_Error with "attempt to stream map cursor";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
---------------
-- Reference --
---------------
function Reference
(Container : aliased in out Map;
Position : Cursor) return Reference_Type
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with
"Position cursor has no element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor designates wrong map";
end if;
pragma Assert (Vet (Position),
"Position cursor in function Reference is bad");
declare
N : Node_Type renames Container.Nodes (Position.Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Reference;
function Reference
(Container : aliased in out Map;
Key : Key_Type) return Reference_Type
is
Node : constant Count_Type := Key_Ops.Find (Container, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with "key not in map";
end if;
declare
N : Node_Type renames Container.Nodes (Node);
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
return R : constant Reference_Type :=
(Element => N.Element'Access,
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Reference;
-------------
-- Replace --
-------------
procedure Replace
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type)
is
Node : constant Count_Type := Key_Ops.Find (Container, Key);
begin
if Checks and then Node = 0 then
raise Constraint_Error with
"attempt to replace key not in map";
end if;
TE_Check (Container.TC);
declare
N : Node_Type renames Container.Nodes (Node);
begin
N.Key := Key;
N.Element := New_Item;
end;
end Replace;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Container : in out Map;
Position : Cursor;
New_Item : Element_Type)
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor of Replace_Element equals No_Element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor of Replace_Element designates wrong map";
end if;
TE_Check (Position.Container.TC);
pragma Assert (Vet (Position), "bad cursor in Replace_Element");
Container.Nodes (Position.Node).Element := New_Item;
end Replace_Element;
----------------------
-- Reserve_Capacity --
----------------------
procedure Reserve_Capacity
(Container : in out Map;
Capacity : Count_Type)
is
begin
if Checks and then Capacity > Container.Capacity then
raise Capacity_Error with "requested capacity is too large";
end if;
end Reserve_Capacity;
--------------
-- Set_Next --
--------------
procedure Set_Next (Node : in out Node_Type; Next : Count_Type) is
begin
Node.Next := Next;
end Set_Next;
--------------------
-- Update_Element --
--------------------
procedure Update_Element
(Container : in out Map;
Position : Cursor;
Process : not null access procedure (Key : Key_Type;
Element : in out Element_Type))
is
begin
if Checks and then Position.Node = 0 then
raise Constraint_Error with
"Position cursor of Update_Element equals No_Element";
end if;
if Checks and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with
"Position cursor of Update_Element designates wrong map";
end if;
pragma Assert (Vet (Position), "bad cursor in Update_Element");
declare
N : Node_Type renames Container.Nodes (Position.Node);
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
Process (N.Key, N.Element);
end;
end Update_Element;
---------
-- Vet --
---------
function Vet (Position : Cursor) return Boolean is
begin
if Position.Node = 0 then
return Position.Container = null;
end if;
if Position.Container = null then
return False;
end if;
declare
M : Map renames Position.Container.all;
X : Count_Type;
begin
if M.Length = 0 then
return False;
end if;
if M.Capacity = 0 then
return False;
end if;
if M.Buckets'Length = 0 then
return False;
end if;
if Position.Node > M.Capacity then
return False;
end if;
if M.Nodes (Position.Node).Next = Position.Node then
return False;
end if;
X := M.Buckets (Key_Ops.Checked_Index
(M, M.Nodes (Position.Node).Key));
for J in 1 .. M.Length loop
if X = Position.Node then
return True;
end if;
if X = 0 then
return False;
end if;
if X = M.Nodes (X).Next then -- to prevent unnecessary looping
return False;
end if;
X := M.Nodes (X).Next;
end loop;
return False;
end;
end Vet;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Map)
is
procedure Write_Node
(Stream : not null access Root_Stream_Type'Class;
Node : Node_Type);
pragma Inline (Write_Node);
procedure Write_Nodes is new HT_Ops.Generic_Write (Write_Node);
----------------
-- Write_Node --
----------------
procedure Write_Node
(Stream : not null access Root_Stream_Type'Class;
Node : Node_Type)
is
begin
Key_Type'Write (Stream, Node.Key);
Element_Type'Write (Stream, Node.Element);
end Write_Node;
-- Start of processing for Write
begin
Write_Nodes (Stream, Container);
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Cursor)
is
begin
raise Program_Error with "attempt to stream map cursor";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
end Ada.Containers.Bounded_Hashed_Maps;
|
logical/conditionalJump.asm | slowy07/learnAsm | 1 | 81081 | <filename>logical/conditionalJump.asm
section .text
global _start
_start:
mov ecx, [num1]
mov ecx, [num2]
jg checkThirdNum
mov ecx, [num2]
checkThirdNum:
cmp ecx, [num3]
jg _exit
mov ecx, [num3]
_exit:
mov [largest], ecx
mov ecx, msg
mov edx, len
mov ebx, 1
mov eax, 4
int 0x80 ;kernel
mov ecx, largest
mov edx, 2
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 1
int 80h
section .data
msg db "largest number is: " 0xA, 0xD
len equ $ -msg
num1 dd '52'
num2 dd '37'
num3 dd '41'
;ouput
;largest number is
;52 |
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt34_pkg.ads | best08618/asylo | 7 | 17249 | package Opt34_Pkg is
type T_Private is record
I : Integer := 0;
end record;
T_Private_Zero : constant T_Private := (I => 0);
function Get_Private (I : Integer) return T_Private;
function Get_Integer (X : T_Private) return Integer;
procedure Assert (Cond : Boolean);
end Opt34_Pkg;
|
pwnlib/shellcraft/templates/thumb/linux/timer_settime.asm | zaratec/pwntools | 5 | 18792 |
<%
from pwnlib.shellcraft.thumb.linux import syscall
%>
<%page args="timerid, flags, value, ovalue"/>
<%docstring>
Invokes the syscall timer_settime. See 'man 2 timer_settime' for more information.
Arguments:
timerid(timer_t): timerid
flags(int): flags
value(itimerspec): value
ovalue(itimerspec): ovalue
</%docstring>
${syscall('SYS_timer_settime', timerid, flags, value, ovalue)}
|
source/nodes/program-nodes-variants.adb | reznikmm/gela | 0 | 19563 | -- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
package body Program.Nodes.Variants is
function Create
(When_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Choices : not null Program.Element_Vectors.Element_Vector_Access;
Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Components : not null Program.Element_Vectors.Element_Vector_Access)
return Variant is
begin
return Result : Variant :=
(When_Token => When_Token, Choices => Choices,
Arrow_Token => Arrow_Token, Components => Components,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Choices : not null Program.Element_Vectors
.Element_Vector_Access;
Components : not null Program.Element_Vectors
.Element_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Variant is
begin
return Result : Implicit_Variant :=
(Choices => Choices, Components => Components,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Choices
(Self : Base_Variant)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Choices;
end Choices;
overriding function Components
(Self : Base_Variant)
return not null Program.Element_Vectors.Element_Vector_Access is
begin
return Self.Components;
end Components;
overriding function When_Token
(Self : Variant)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.When_Token;
end When_Token;
overriding function Arrow_Token
(Self : Variant)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Arrow_Token;
end Arrow_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Variant)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Variant)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Variant)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize (Self : in out Base_Variant'Class) is
begin
for Item in Self.Choices.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
for Item in Self.Components.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Variant (Self : Base_Variant) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Variant;
overriding function Is_Definition (Self : Base_Variant) return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Definition;
overriding procedure Visit
(Self : not null access Base_Variant;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Variant (Self);
end Visit;
overriding function To_Variant_Text
(Self : in out Variant)
return Program.Elements.Variants.Variant_Text_Access is
begin
return Self'Unchecked_Access;
end To_Variant_Text;
overriding function To_Variant_Text
(Self : in out Implicit_Variant)
return Program.Elements.Variants.Variant_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Variant_Text;
end Program.Nodes.Variants;
|
externals/mpir-3.0.0/mpn/x86_64w/sub_err2_n.asm | JaminChan/eos_win | 12 | 167472 | <reponame>JaminChan/eos_win<gh_stars>10-100
; PROLOGUE(mpn_sub_err2_n)
;
; AMD64 mpn_add_err2_n, mpn_sub_err2_n
;
; Copyright (C) 2009, <NAME>
;
; Windows Conversion Copyright 2008 <NAME>
;
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are
; met:
;
; 1. Redistributions of source code must retain the above copyright notice,
; this list of conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
; mp_limb_t mpn_add_err2_n (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_limb_t);
; mp_limb_t mpn_sub_err2_n (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_limb_t);
; rax rdi rsi rdx rcx r8 r9 8(rsp) 16(rsp)
; rax rcx rdx r8 r9 [rsp+40] [rsp+48] [rsp+56] [rsp+64]
%include "yasm_mac.inc"
%define reg_save_list rbx, rsi, rdi, rbp, r12, r13, r14
%macro fun 2
xalign 16
FRAME_PROC %1, 0, reg_save_list
mov rax, qword [rsp+stack_use+56]
lea rdi, [rcx+rax*8]
lea rsi, [rdx+rax*8]
lea rdx, [r8+rax*8]
mov rcx, r9
mov r10, rax
mov r8, [rsp+stack_use+40]
mov r9, [rsp+stack_use+48]
mov rax, [rsp+stack_use+64]
xor rbp, rbp
xor r11, r11
xor r12, r12
xor r13, r13
sub r9, r8
test r10, 1
jnz %%1
lea r8, [r8+r10*8-8]
neg r10
jmp %%2
xalign 16
%%1:lea r8, [r8+r10*8-16]
neg r10
shr rax, 1
mov rbx, [rsi+r10*8]
%2 rbx, [rdx+r10*8]
cmovc rbp, [r8+8]
cmovc r12, [r8+r9+8]
mov [rdi+r10*8], rbx
sbb rax, rax
inc r10
jz %%3
xalign 16
%%2:mov rbx, [rsi+r10*8]
shr rax, 1
%2 rbx, [rdx+r10*8]
mov [rdi+r10*8], rbx
sbb r14, r14
mov rbx, [rsi+r10*8+8]
%2 rbx, [rdx+r10*8+8]
mov [rdi+r10*8+8], rbx
sbb rax, rax
mov rbx, [r8]
and rbx, r14
add rbp, rbx
adc r11, 0
and r14, [r8+r9]
add r12, r14
adc r13, 0
mov rbx, [r8-8]
and rbx, rax
add rbp, rbx
adc r11, 0
mov rbx, [r8+r9-8]
and rbx, rax
add r12, rbx
adc r13, 0
add r10, 2
lea r8, [r8-16]
jnz %%2
%%3:mov [rcx], rbp
mov [rcx+8], r11
mov [rcx+16], r12
mov [rcx+24], r13
and eax, 1
END_PROC reg_save_list
%endmacro
CPU Athlon64
BITS 64
; global __gmpn_sub_err2_n
fun mpn_sub_err2_n, sbb
end
|
BasicILP/Syntax/Common.agda | mietek/hilbert-gentzen | 29 | 1200 | -- Basic intuitionistic logic of proofs, without ∨, ⊥, or +.
-- Common syntax.
module BasicILP.Syntax.Common where
open import Common.ContextPair public
|
oeis/002/A002408.asm | neoneye/loda-programs | 11 | 100765 | ; A002408: Expansion of 8-dimensional cusp form.
; Submitted by <NAME>
; 0,1,-8,28,-64,126,-224,344,-512,757,-1008,1332,-1792,2198,-2752,3528,-4096,4914,-6056,6860,-8064,9632,-10656,12168,-14336,15751,-17584,20440,-22016,24390,-28224,29792,-32768,37296,-39312,43344,-48448,50654,-54880,61544,-64512,68922,-77056,79508,-85248,95382,-97344,103824,-114688,117993,-126008,137592,-140672,148878,-163520,167832,-176128,192080,-195120,205380,-225792,226982,-238336,260408,-262144,276948,-298368,300764,-314496,340704,-346752,357912,-387584,389018,-405232,441028,-439040,458208
mov $4,$0
add $0,1
add $0,$4
mov $2,$0
lpb $0
sub $0,1
mov $1,$3
sub $2,1
mov $3,$2
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
pow $3,3
sub $3,$1
lpe
mov $0,$3
div $0,8
|
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/polygon.lzh/polygon/sf2/trans.asm | prismotizm/gigaleak | 0 | 83964 | Name: trans.asm
Type: file
Size: 19654
Last-Modified: '1993-01-07T04:42:33Z'
SHA-1: 5ADA130F420ECA601006F3D0DCFD963854D44888
Description: null
|
test/agda/FRP/JS/QUnit.agda | agda/agda-frp-js | 63 | 3585 | <reponame>agda/agda-frp-js
open import FRP.JS.Bool using ( Bool )
open import FRP.JS.True using ( ⊤ ; tt )
open import FRP.JS.String using ( String )
open import FRP.JS.True using ( True )
open import FRP.JS.RSet
open import FRP.JS.Behaviour
module FRP.JS.QUnit where
infixr 4 _,_
data Test : Set where
ε : Test
_,_ : Test → Test → Test
ok : String → (b : {t : ⊤} → Bool) → {b✓ : True b} → Test
ok! : String → (b : {t : ⊤} → Bool) → Test
ok◇ : String → (b : ⟦ Beh ⟨ Bool ⟩ ⟧) → Test
data TestSuite : Set where
ε : TestSuite
_,_ : TestSuite → TestSuite → TestSuite
test : String → Test → TestSuite
data TestSuites : Set where
ε : TestSuites
_,_ : TestSuites → TestSuites → TestSuites
suite : String → TestSuite → TestSuites
|
scripts/lib/+arrays.applescript | ChristoferK/AppleScriptive | 32 | 1596 | #!/usr/bin/osascript
--------------------------------------------------------------------------------
# pnam: +ARRAYS
# nmxt: .applescript
# pDSC: List manipulation handlers
--------------------------------------------------------------------------------
# sown: CK
# ascd: 2018-08-23
# asmo: 2019-05-08
--------------------------------------------------------------------------------
property name : "arrays"
property id : "chri.sk.applescript.lib:arrays"
property version : 1.0
property parent: AppleScript
--------------------------------------------------------------------------------
# HANDLERS & SCRIPT OBJECTS:
# make [ see: array(), emptyarray() ]
# Generates a list of N objects, which are, by default, the integers from 1
# to +N in order. If +x is supplied, the generated list contains +N
# occurrences of the object +x. pseudorandomness takes priority over +x, and
# will cause the generated list to contain +N random integers no greater in
# value than +N.
to make N at x : null given pseudorandomness:random as boolean : false
local N, x, random
script
property list : {}
end script
tell the result
if random then
repeat with i from 1 to N
set end of its list to random number to N
end repeat
else if x = null then
repeat with i from 1 to N
set end of its list to i
end repeat
else
repeat N times
set end of its list to x
end repeat
end if
its list
end tell
end make
on array(N) -- Generates a list of integers from 1 to +N
make N
end array
on emptyarray(N) -- Generates a list of +N missing values
make N at missing value
end emptyarray
# offset
# Lists the indices of each occurrence of the item +x in list +L
on offset of x in L
local x, L
if x is not in L then return {}
script
on found(x)
script
on fn(y, |ξ|, i)
if y = x then set end of |ξ| to i
|ξ|
end fn
end script
end found
end script
foldItems from L at {} given handler:result's found(x)
end offset
# __()
# Wraps handler or list class data in a script object.
# For handlers, increases versatility for creating complex functions used by
# other handlers; for lists, decreases access time to items in large sets.
on __(obj)
local obj
if the class of obj = handler then
script
property fn : obj
end script
return the result
else if the class of obj = list then
script
property list : obj
end script
return a reference to the result's list
end if
return obj
end __
# iterate [ see: generator() ]
# Returns a script object that acts as a generator to obtain the next item
# in a potentially infinite list of items where each item is generated from
# the last by repeated application of a function.
on iterate for N : 0 from y : 1 to max : null given handler:function
script
property list : {}
property length : N
property item : y
property index : 0
property func : function
on x()
tell my list
set its end to its last item
a reference to its last item
end tell
end x
to next()
set index to index + 1
if index = 1 then return my item
tell __(func) to set my item to the ¬
fn(my item, my index, my list)
end next
to yield(N)
local N
repeat N times
set end of my list to next()
end repeat
my list
end yield
on upto(max)
local max
repeat
if next() > max then return my list
set end of my list to my item
end repeat
end upto
end script
tell the result
if N > 0 then return its yield(N)
if max ≠ null then return upto(max)
it
end tell
end iterate
on generator(fn, y)
iterate from y given handler:fn
end generator
# mapItems
# Applies a given handler (function) to each item in a list (+L). The items
# of the supplied list are overwritten with their new values.
to mapItems from L as list given handler:function
local L, function
script
property list : L
end script
tell (a reference to the result's list)
repeat with i from 1 to its length
set x to (a reference to its item i)
copy fn(x's contents, i, it) ¬
of my __(function) ¬
to the contents of x
end repeat
end tell
L
end mapItems
# filterItems
# Filters a list (+L) to include only those items that pass a given test as
# defined by a predicate (function). The original list remains in tact.
to filterItems from L as list into R as list : null given handler:function
local L, R
if R = null then set R to {}
script
property list : L
property result : R
end script
tell the result to repeat with x in its list
if my __(function)'s fn(x, L, R) then set ¬
end of its result to x's contents
end repeat
R
end filterItems
# foldItems
# Reduces a list through a specificed handler (function), accumulating the
# result as it goes, returning the accumulated value. The original list
# remains unchanged.
to foldItems from L at |ξ| : 0 given handler:function
local L, |ξ|, function
script
property list : L
end script
tell the result's list to repeat with i from 1 to its length
set x to its item i
tell my __(function)'s fn(x, |ξ|, i, L)
if it = null then exit repeat
set |ξ| to it
end tell
end repeat
|ξ|
end foldItems
# replaceItems
# Overwrites items in |L₁| starting at the specified +index using the items
# taken, in order, from |L₂|, extending the original list if necessary. If
# passing an +index of 0, the items are appended.
to replaceItems from |L₂| as list : {} into |L₁| as list at index : 0
local xs, L, index
set N to |L₁|'s length
set i to (index + N + 1) mod (N + 1)
if i = 0 then set i to N + 1
script
property list : |L₁|
property xs : |L₂|
end script
tell the result
repeat with x in its xs
if i ≤ N then
set its list's item i to x's contents
else
set end of its list to x's contents
end if
set i to i + 1
end repeat
return its list
end tell
end replaceItems
# pushItems
# Inserts a list of items (+xs) into a given list (+L) at index +i, moving the
# existing items to its right the appropriate number of places. The original
# list is not affected. The resulting list can be longer than the original
# if the number of items to be pushed extend beyond the number of items the
# original list can accommodate.
to pushItems onto L as list at i as integer : 0 given list:A as list : {}
local L, i, A
script
property list : L
property xs : A
property N : L's length
property index : (i + N + 1) mod (N + 1)
end script
tell the result
set i to its index
if i = 0 then
set its list to its list & its xs
else if i = 1 then
set its list to its xs & its list
else
set its list to ¬
(its list's items 1 thru (i - 1)) & ¬
(its xs) & ¬
(its list's items i thru -1)
its list
end if
end tell
end pushItems
# difference()
# Returns the difference of two lists, i.e. the items in +A that are not
# present in +B, A - B.
on difference(A as list, B as list)
local A, B
script
on notMember(M)
script
on fn(x)
x is not in M
end fn
end script
end notMember
end script
filterItems from A given handler:result's notMember(B)
end difference
# intersection()
# Returns the intersection of two lists, i.e. those items in +A that are also
# in +B.
on intersection(A as list, B as list)
local A, B
script
on member(M)
script
on fn(x)
x is in M
end fn
end script
end member
end script
filterItems from A given handler:result's member(B)
end intersection
# union()
# Returns the union of two lists, i.e. merges the items of both lists
on union(A as list, B as list)
local A, B
script
on insert(x, L)
set end of L to x
L
end insert
end script
foldItems from A at B given handler:result's insert
end union
# unique:
# Returns every item in a list as a unique entity in a new list, i.e. makes
# list +L into a pseudoset
on unique:L
local L
script
on notMember(x, i, L)
x is not in L
end notMember
end script
filterItems from L given handler:result's notMember
end unique:
# zip()
# Takes the corresponding items from two lists and concatenates them into
# a list of lists
to zip(A, B)
local L
script
to concat(x, |ξ|, i)
set item i of |ξ| to {} & item i of |ξ| & x as list
|ξ|
end concat
end script
foldItems from B at A given handler:result's concat
end zip
# multiply()
# Multiples two values together. If the second value, +L, is a list, then
# every item in that list is multiplied by +x.
to multiply(x, L)
local x, L
set unary to L's class ≠ list
script
to multiplyBy:x
script
on fn(y)
x * y
end fn
end script
end multiplyBy:
end script
set R to mapItems from L given handler:result's multiplyBy:x
if unary then set [R] to R
R
end multiply
# add()
# Adds two values together. If the second value, +L, is a list, then +x is
# added to every item in that list.
to add(x, L)
local x, L
set unary to L's class ≠ list
script
to add:x
script
on fn(y)
x + y
end fn
end script
end add:
end script
set R to mapItems from L given handler:result's add:x
if unary then set [R] to R
R
end add
# sum:
# Returns the sum of a list of numbers
on sum:L
foldItems from L given handler:add
end sum:
on product:L
foldItems from L at 1 given handler:multiply
end product:
# max:
# Returns the maximum value from a list of numbers (or strings)
on max:L
local L
script
on maximum(x, y)
if x ≥ y then return x
y
end maximum
end script
foldItems from L given handler:result's maximum
end max:
# min:
# Returns the minimum value from a list of numbers (or strings)
on min:L
local L
script
on minimum(x, y)
if x ≤ y then return x
y
end minimum
end script
foldItems from L at L's first item given handler:result's minimum
end min:
# min:
# Returns the mean value of a list of numbers
on mean:L
local L
(my sum:L) / (length of L)
end mean:
# swap()
# Swaps the items at indices +i and +j in a list (+L) with one another
on swap(L, i, j)
local L, i, j
set [item i of L, item j of L] to [item j, item i] of L
L
end swap
# sort:
# Sorts a list of numbers in ascending numerical value. The original list
# is overwritten as it is sorted. This is an inefficient algorithm.
to sort:(L as list)
local L
if L = {} then return {}
if L's length = 1 then return L
script
property list : L
end script
tell (a reference to the result's list)
set [x, xs] to [¬
a reference to its item 1, ¬
a reference to rest of it]
set [i] to my (offset of (my min:it) in it)
if i ≠ 1 then my swap(it, 1, i)
set its contents to {x's contents} & (my sort:(xs))
it
end tell
end sort:
# rotate:
# Rotates a list by one anti-clockwise. The original list is overwritten.
to rotate:L
local L
if length of L < 2 then return L
script
property list : L
property x : item 1 of my list
to unshift(x, i, L)
local x, i, L
if i = L's length then return missing value
item (i + 1) of L
end unshift
end script
mapItems from L given handler:result's unshift
set last item of L to x
L
end rotate:
# cycle:
# Like rotate: but preserves the original list, and is therefore much faster
on cycle:L
local L
(rest of L) & item 1 of L
end cycle:
# flatten:
# Returns a flattened version a nested list as a one-dimensional list
to flatten:L
foldItems from L at {} given handler:union
end flatten:
# head:
# Returns the first item of a list, overwriting the original
on head:L
local L
tell (a reference to L)
set its contents to item 1
return its contents
end tell
end head:
# tail: [ syn.
# Returns all but the first item of a list, ovverwriting the original
on tail:L
local L
tell (a reference to L)
set its contents to the rest of L
return its contents
end tell
end tail:
to shift(L)
tail_(L)
end shift
# body:
# Returns all but the last item of a list
on body:L
if L's length < 2 then return null
items 1 thru -2 of L
end body:
# anus:
# Returns the last item of a list
on anus:L
if L's length < 1 then return null
item -1 of L
end anus:
# torso:
# Returns all but the first and last items of a list
on torso:L
if L's length < 2 then return null
tail_(body_(L))
end torso:
---------------------------------------------------------------------------❮END❯ |
programs/oeis/175/A175406.asm | karttu/loda | 1 | 26818 | <reponame>karttu/loda
; A175406: The greatest integer k such that (1+1/n)^k <= 2.
; 1,1,2,3,3,4,5,5,6,7,7,8,9,10,10,11,12,12,13,14,14,15,16,16,17,18,19,19,20,21,21,22,23,23,24,25,25,26,27,28,28,29,30,30,31,32,32,33,34,35,35,36,37,37,38,39,39,40,41,41,42,43,44,44,45,46,46,47,48,48,49,50,50,51
mov $1,$0
mul $1,34
div $1,49
add $1,1
|
thirdparty/adasdl/thin/adasdl/AdaSDL_ttf/sdl_ttf.adb | Lucretia/old_nehe_ada95 | 0 | 20480 | <filename>thirdparty/adasdl/thin/adasdl/AdaSDL_ttf/sdl_ttf.adb
package body SDL_ttf is
-- ====================================
function Open_Font (file : String; ptsize : C.int) return Font_ptr is
begin
return OpenFont (CS.New_String (file), ptsize);
end Open_Font;
-- ====================================
function Open_Font_Index (file : String;
ptsize : C.int; index : C.long)
return Font_ptr is
begin
return OpenFontIndex (CS.New_String (file), ptsize, index);
end Open_Font_Index;
-- ====================================
function Font_Face_Family_Name (font : Font_ptr) return String is
begin
return CS.Value (FontFaceFamilyName (font));
end Font_Face_Family_Name;
-- ====================================
function Font_Face_Style_Name (font : Font_ptr) return String is
begin
return CS.Value (FontFaceStyleName (font));
end Font_Face_Style_Name;
-- ====================================
function Size_Text (font : Font_ptr; text : String;
w, h : C.int) return C.int is
begin
return (SizeText (font, CS.New_String (text), w, h));
end Size_Text;
-- ====================================
function Size_UTF8 (font : Font_ptr; text : String;
w, h : C.int) return C.int is
begin
return (SizeUTF8 (font, CS.New_String (text), w, h));
end Size_UTF8;
-- ====================================
function Render_Text_Solid (font : Font_ptr; text : String;
fg : V.Color) return V.Surface_ptr is
begin
return RenderText_Solid (font, CS.New_String (text), fg);
end Render_Text_Solid;
-- ====================================
function Render_UTF8_Solid (font : Font_ptr; text : String;
fg : V.Color) return V.Surface_ptr is
begin
return RenderUTF8_Solid (font, CS.New_String (text), fg);
end Render_UTF8_Solid;
-- ====================================
function Render_Text_Shaded (font : Font_ptr; text : String;
fg : V.Color; bg : V.Color) return V.Surface_ptr is
begin
return RenderText_Shaded (font, CS.New_String (text), fg, bg);
end Render_Text_Shaded;
-- ====================================
function Render_UTF8_Shaded (font : Font_ptr; text : String;
fg : V.Color; bg : V.Color) return V.Surface_ptr is
begin
return RenderUTF8_Shaded (font, CS.New_String (text), fg, bg);
end Render_UTF8_Shaded;
-- ====================================
function Render_Text_Blended (font : Font_ptr; text : String;
fg : V.Color) return V.Surface is
begin
return RenderText_Blended (font, CS.New_String (text), fg);
end Render_Text_Blended;
-- ====================================
function Render_UTF8_Blended (font : Font_ptr; text : String;
fg : V.Color) return V.Surface is
begin
return RenderUTF8_Blended (font, CS.New_String (text), fg);
end Render_UTF8_Blended;
-- ====================================
procedure Set_Font_Style (font : Font_ptr; style : TTF_STYLE) is
begin
SetFontStyle (font, style);
end Set_Font_Style;
end SDL_ttf;
|
source/program_structure/adam-library_unit-declaration.adb | charlie5/aIDE | 3 | 19521 | <filename>source/program_structure/adam-library_unit-declaration.adb
with
AdaM.Factory;
package body AdaM.library_Unit.declaration
is
-- Storage Pool
--
record_Version : constant := 1;
pool_Size : constant := 5_000;
package Pool is new AdaM.Factory.Pools (".adam-store",
"library_Units-declaration",
pool_Size,
record_Version,
library_Unit.declaration.item,
library_Unit.declaration.view);
-- Forge
--
procedure define (Self : in out Item)
is
begin
null;
end define;
overriding
procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
function new_Subprogram return View
is
new_unit_Declaration : constant library_Unit.declaration.view := Pool.new_Item;
new_Subprogram : constant AdaM.Declaration.of_subprogram.view := AdaM.Declaration.of_subprogram.new_Declaration;
begin
define (library_Unit.declaration.item (new_unit_Declaration.all));
new_unit_Declaration.Declaration := (a_Subprogram, new_Subprogram);
return new_unit_Declaration;
end new_Subprogram;
function new_Package return library_Unit.declaration.view
is
new_unit_Declaration : constant library_Unit.declaration.view := Pool.new_Item;
new_Package : constant AdaM.Declaration.of_package.view := AdaM.Declaration.of_package.new_Package;
begin
define (library_Unit.declaration.item (new_unit_Declaration.all));
new_unit_Declaration.Declaration := (a_Package, new_Package);
return new_unit_Declaration;
end new_Package;
function new_Generic return library_Unit.declaration.view
is
new_unit_Declaration : constant library_Unit.declaration.view := Pool.new_Item;
new_Generic : constant AdaM.Declaration.of_generic.view := AdaM.Declaration.of_generic.new_Declaration;
begin
define (library_Unit.declaration.item (new_unit_Declaration.all));
new_unit_Declaration.Declaration := (a_Generic, new_Generic);
return new_unit_Declaration;
end new_Generic;
function new_Intantiation return library_Unit.declaration.view
is
new_unit_Declaration : constant library_Unit.declaration.view := Pool.new_Item;
new_Instaniation : constant AdaM.Declaration.of_instantiation.view := AdaM.Declaration.of_instantiation.new_Declaration;
begin
define (library_Unit.declaration.item (new_unit_Declaration.all));
new_unit_Declaration.Declaration := (an_Instantiation, new_Instaniation);
return new_unit_Declaration;
end new_Intantiation;
procedure free (Self : in out library_Unit.declaration.view)
is
begin
destruct (library_Unit.declaration.item (Self.all));
Pool.free (Self);
end free;
-- Attributes
--
overriding
function Id (Self : access Item) return AdaM.Id
is
begin
return Pool.to_Id (Self);
end Id;
function my_Package (Self : in Item) return AdaM.Declaration.of_package.view
is
begin
return Self.Declaration.of_Package;
end my_Package;
-- Streams
--
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View)
renames Pool.View_write;
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View)
renames Pool.View_read;
end AdaM.library_Unit.declaration;
|
programs/oeis/117/A117088.asm | neoneye/loda | 22 | 86838 | ; A117088: a(n) = (11*5^n - 7)/4.
; 1,12,67,342,1717,8592,42967,214842,1074217,5371092,26855467,134277342,671386717,3356933592,16784667967,83923339842,419616699217,2098083496092,10490417480467,52452087402342,262260437011717,1311302185058592,6556510925292967,32782554626464842,163912773132324217,819563865661621092,4097819328308105467,20489096641540527342,102445483207702636717,512227416038513183592,2561137080192565917967,12805685400962829589842,64028427004814147949217,320142135024070739746092,1600710675120353698730467,8003553375601768493652342,40017766878008842468261717,200088834390044212341308592,1000444171950221061706542967,5002220859751105308532714842,25011104298755526542663574217,125055521493777632713317871092,625277607468888163566589355467,3126388037344440817832946777342,15631940186722204089164733886717,78159700933611020445823669433592,390798504668055102229118347167967,1953992523340275511145591735839842,9769962616701377555727958679199217,48849813083506887778639793395996092,244249065417534438893198966979980467
mov $1,5
pow $1,$0
div $1,4
mul $1,11
add $1,1
mov $0,$1
|
awa/plugins/awa-changelogs/regtests/awa-changelogs-modules-tests.adb | fuzzysloth/ada-awa | 81 | 12536 | -----------------------------------------------------------------------
-- awa-changelogs-tests -- Tests for changelogs
-- Copyright (C) 2014, 2015 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with Security.Contexts;
with AWA.Services.Contexts;
with AWA.Users.Models;
with AWA.Tests.Helpers.Users;
package body AWA.Changelogs.Modules.Tests is
package Caller is new Util.Test_Caller (Test, "AWA.Changelogs");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Changelogs.Add_Log",
Test_Add_Log'Access);
end Add_Tests;
procedure Test_Add_Log (T : in out Test) is
Sec_Ctx : Security.Contexts.Security_Context;
Context : AWA.Services.Contexts.Service_Context;
begin
AWA.Tests.Helpers.Users.Login (Context, Sec_Ctx, "<EMAIL>");
declare
Change_Manager : constant Changelog_Module_Access := Get_Changelog_Module;
User : constant AWA.Users.Models.User_Ref := Context.Get_User;
begin
T.Assert (Change_Manager /= null, "There is no changelog module");
Change_Manager.Add_Log (User.Get_Id, "awa_user", "A first changelog for the user");
end;
end Test_Add_Log;
end AWA.Changelogs.Modules.Tests;
|
Transynther/x86/_processed/US/_zr_/i7-8650U_0xd2_notsx.log_875_35.asm | ljhsiun2/medusa | 9 | 170667 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x414f, %rsi
lea addresses_WT_ht+0x1b29f, %rdi
clflush (%rdi)
nop
inc %r11
mov $82, %rcx
rep movsb
nop
cmp $18960, %rdi
lea addresses_WT_ht+0x15a4f, %rbp
nop
cmp $6272, %rsi
mov (%rbp), %r8
nop
xor $39276, %rbp
lea addresses_WC_ht+0xe44f, %r11
nop
inc %r9
mov (%r11), %rsi
nop
nop
add %rcx, %rcx
lea addresses_A_ht+0xa837, %rbp
nop
nop
add $26434, %r11
movw $0x6162, (%rbp)
nop
nop
nop
nop
nop
cmp $362, %rbp
lea addresses_normal_ht+0x1c78f, %rsi
lea addresses_D_ht+0x580f, %rdi
nop
nop
nop
nop
dec %rbx
mov $56, %rcx
rep movsl
nop
sub $29406, %r11
lea addresses_UC_ht+0x17f4f, %rsi
lea addresses_WT_ht+0x168ef, %rdi
nop
nop
nop
nop
nop
dec %r8
mov $17, %rcx
rep movsl
nop
nop
nop
xor $15060, %rsi
lea addresses_WT_ht+0xf7cf, %r8
sub $63720, %rsi
movb (%r8), %r9b
nop
inc %rdi
lea addresses_A_ht+0x19d37, %rsi
lea addresses_A_ht+0xc14f, %rdi
nop
nop
sub $58820, %r11
mov $120, %rcx
rep movsb
nop
nop
nop
add %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %r8
push %r9
push %rax
push %rdi
// Load
lea addresses_normal+0xe54f, %rax
nop
nop
nop
nop
nop
xor $58730, %r15
movb (%rax), %r9b
nop
nop
nop
nop
mfence
// Load
lea addresses_D+0xc767, %rdi
clflush (%rdi)
nop
nop
nop
nop
cmp $18824, %r14
mov (%rdi), %r13d
nop
nop
nop
and %r15, %r15
// Faulty Load
lea addresses_US+0xe14f, %rdi
nop
nop
nop
nop
xor $11857, %rax
mov (%rdi), %r15w
lea oracles, %r14
and $0xff, %r15
shlq $12, %r15
mov (%r14,%r15,1), %r15
pop %rdi
pop %rax
pop %r9
pop %r8
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}}
{'00': 875}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/apsepp-test_reporter_data_struct_class-impl.adb | thierr26/ada-apsepp | 0 | 21486 | <reponame>thierr26/ada-apsepp
-- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
with Ada.Unchecked_Deallocation;
package body Apsepp.Test_Reporter_Data_Struct_Class.Impl is
----------------------------------------------------------------------------
not overriding
procedure Add_And_Or_Set_Active_Node
(Obj : in out Test_Reporter_Data;
T : Tag;
C : out Node_Data_Trees.Cursor) is
use Node_Data_Hashed_Maps; -- Makes "=" for type
-- Node_Data_Hashed_Maps.Cursor directly
-- visible.
Active_Node_Map_C : constant Node_Data_Hashed_Maps.Cursor
:= Obj.Active_Node_Map.Find (T);
begin
if Active_Node_Map_C = Node_Data_Hashed_Maps.No_Element then
C := Node_Data_Trees.No_Element;
for Cu in Obj.Node_Data_Tree.Iterate loop
if Node_Data_Trees.Element (Cu).T = T then
C := Cu;
exit;
end if;
end loop;
if C = Node_Data_Trees.No_Element then
-- TODO: Refactor the Insert_Child calls.
Obj.Node_Data_Tree.Insert_Child
(Parent => Root (Obj.Node_Data_Tree),
Before => Node_Data_Trees.No_Element,
New_Item => (T => T,
Event_Index_Vector => <>),
Position => C);
end if;
Obj.Active_Node_Map.Insert (Key => T,
New_Item => C);
else
C := Element (Active_Node_Map_C);
end if;
end Add_And_Or_Set_Active_Node;
----------------------------------------------------------------------------
overriding
function Is_Empty (Obj : Test_Reporter_Data) return Boolean
is (Obj.Active_Node_Map.Is_Empty
and then
Obj.Event_Vector.Is_Empty
and then
Obj.Node_Data_Tree.Is_Empty);
----------------------------------------------------------------------------
overriding
procedure Reset (Obj : in out Test_Reporter_Data) is
-----------------------------------------------------
procedure Clean_Up_Events (Position : Node_Event_Vectors.Cursor) is
N_E : Node_Event := Node_Event_Vectors.Element (Position);
procedure Free is new Ada.Unchecked_Deallocation
(Object => Test_Event_Base'Class,
Name => Test_Event_Access);
begin
N_E.Event.Clean_Up;
Free (N_E.Event);
end Clean_Up_Events;
-----------------------------------------------------
begin
Obj.Active_Node_Map.Clear;
Obj.Event_Vector.Iterate (Clean_Up_Events'Access);
Obj.Event_Vector.Clear;
Obj.Node_Data_Tree.Clear;
end Reset;
----------------------------------------------------------------------------
overriding
function Is_Active (Obj : Test_Reporter_Data;
Node_Tag : Tag) return Boolean
is (Obj.Active_Node_Map.Contains (Node_Tag));
----------------------------------------------------------------------------
overriding
procedure Include_Node (Obj : in out Test_Reporter_Data;
Node_Lineage : Tag_Array) is
C : Cursor := Root (Obj.Node_Data_Tree);
begin
for T of Node_Lineage loop
declare
Insertion_Required : Boolean := Is_Leaf (C);
begin
for Child_C in Obj.Node_Data_Tree.Iterate_Children (C) loop
if Element (Child_C).T = T then
C := Child_C;
exit;
end if;
Insertion_Required := Child_C = Last_Child (C);
end loop;
if Insertion_Required then
declare
Position : Cursor;
begin
Obj.Node_Data_Tree.Insert_Child
(Parent => C,
Before => No_Element,
New_Item => (T => T,
Event_Index_Vector => <>),
Position => Position);
C := Position;
end;
end if;
end;
end loop;
end Include_Node;
----------------------------------------------------------------------------
overriding
procedure Add_Event (Obj : in out Test_Reporter_Data;
Node_Tag : Tag;
Event : Test_Event_Base'Class) is
-----------------------------------------------------
procedure Update_Node_Event_Vector (Element : in out Node_Data) is
begin
Element.Event_Index_Vector.Append (Obj.Event_Vector.Last_Index);
end Update_Node_Event_Vector;
-----------------------------------------------------
C : Cursor;
begin
Obj.Add_And_Or_Set_Active_Node (Node_Tag, C);
Obj.Event_Vector.Append (
(Node_Data_Cursor => C,
Event => new Test_Event_Base'Class'(Event)));
Obj.Node_Data_Tree.Update_Element (C, Update_Node_Event_Vector'Access);
if Event.Is_Node_Run_Final_Event then
Obj.Active_Node_Map.Delete (Key => Node_Tag);
end if;
end Add_Event;
----------------------------------------------------------------------------
end Apsepp.Test_Reporter_Data_Struct_Class.Impl;
|
oeis/070/A070968.asm | neoneye/loda-programs | 11 | 105274 | <filename>oeis/070/A070968.asm
; A070968: Number of cycles in the complete bipartite graph K(n,n).
; Submitted by <NAME>
; 0,1,15,204,3940,113865,4662231,256485040,18226108944,1623855701385,177195820499335,23237493232953516,3605437233380095620,653193551573628900289,136634950180317224866335,32681589590709963123092160,8863149183726257535369633856,2705067494469127432159530155505,922995819594932956113738368398239,350014073794168154275473348323458540,146732891850145768348143177070118246340,67676764935877540898604422663620480559001,34192200819458805075206784812449604507666695
add $0,1
mov $3,$0
mov $4,1
lpb $3
mul $1,$3
mul $4,$3
add $1,$4
mul $1,$3
cmp $4,0
add $5,$4
mov $6,$5
cmp $6,0
add $5,$6
div $1,$5
add $2,$1
mul $1,$5
mul $2,$4
sub $3,1
div $4,$5
lpe
mov $0,$2
div $0,2
|
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sccz80/dge.asm | jpoikela/z88dk | 640 | 17784 |
SECTION code_clib
SECTION code_fp_math48
PUBLIC dge
EXTERN cm48_sccz80p_dge
defc dge = cm48_sccz80p_dge
|
programs/oeis/089/A089620.asm | jmorken/loda | 1 | 28692 | <filename>programs/oeis/089/A089620.asm
; A089620: n^3 + n-th prime.
; 3,11,32,71,136,229,360,531,752,1029,1362,1765,2238,2787,3422,4149,4972,5893,6926,8071,9334,10727,12250,13913,15722,17677,19786,22059,24498,27113,29918,32899,36074,39443,43024,46807,50810,55035,59486,64173
mov $9,$0
mov $11,2
mov $14,$0
lpb $11
mov $0,$9
sub $11,1
add $0,$11
sub $0,1
mov $2,$0
mov $5,$0
mov $6,$0
cal $0,40 ; The prime numbers.
add $2,$0
mov $3,$5
sub $3,2
add $4,$2
sub $4,$3
mov $1,$4
mov $8,$6
mul $8,2
add $1,$8
mov $12,$11
lpb $12
mov $10,$1
sub $12,1
lpe
lpe
mov $1,$10
sub $1,1
add $1,$14
mov $13,$14
mul $13,$14
mov $7,$13
mul $7,3
add $1,$7
mul $13,$14
add $1,$13
|
src/main/java/uk/nhs/digital/mait/tkwx/tk/internalservices/rules/parser/SimulatorRulesLexer.g4 | nhsdigitalmait/TKW-x | 0 | 3783 | /*
Copyright 2012-13 <NAME> <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
lexer grammar SimulatorRulesLexer;
options {
language = Java;
}
// context sensitive lexer behaviour -
// if in a set directive takes everything after the variable as the ANNOTATION_TEXT token value
@header {
package uk.nhs.digital.mait.tkwx.tk.internalservices.rules.parser;
}
@lexer::members {
private final static boolean DEBUG = false;
}
/* --------------------------------------------------------------------------------------------------- */
// Lexer token definitions
COMMENT : '#' ~[\r\n]* ( ('\r'? '\n')+ | EOF ) -> channel(HIDDEN) ; // discard the comments
NL : '\r'? '\n' -> channel(HIDDEN);
// If we redirect spaces to HIDDEN rather than skip we can get back the whole line including spaces
// by referencing $text
SPACES : [ \t]+ -> channel(HIDDEN) ;
ESCAPED_QUOTE : '\\"' ;
// remove the surrounding quotes and unescape escaped quotes
QUOTED_STRING : '"' ( ESCAPED_QUOTE | ~["] )*? '"' { setText(getText().replaceFirst("^\"(.*)\"$", "$1").replaceAll("\\\\\"","\"")); } ;
fragment BEGIN_TOKEN : 'BEGIN' ;
fragment END_TOKEN : 'END' ;
fragment DIGIT : [0-9] ;
fragment ALPHA : [a-zA-Z] ;
// for case insensive tokens
fragment A:('a'|'A');
fragment B:('b'|'B');
fragment C:('c'|'C');
fragment D:('d'|'D');
fragment E:('e'|'E');
fragment F:('f'|'F');
fragment G:('g'|'G');
fragment H:('h'|'H');
fragment I:('i'|'I');
fragment J:('j'|'J');
fragment K:('k'|'K');
fragment L:('l'|'L');
fragment M:('m'|'M');
fragment N:('n'|'N');
fragment O:('o'|'O');
fragment P:('p'|'P');
fragment Q:('q'|'Q');
fragment R:('r'|'R');
fragment S:('s'|'S');
fragment T:('t'|'T');
fragment U:('u'|'U');
fragment V:('v'|'V');
fragment W:('w'|'W');
fragment X:('x'|'X');
fragment Y:('y'|'Y');
fragment Z:('z'|'Z');
LPAREN : '(' ;
RPAREN : ')' ;
COLON : ':' ;
INTEGER : '-'? DIGIT+ ;
DOT : '.' ;
// rules (case insensitive)
IF : I F ;
THEN : T H E N ;
ELSE : E L S E ;
INCLUDE : 'INCLUDE' ;
NONE : 'NONE' ;
// Substitution types - case sensitive
UUID_UPPER : 'UUID' ;
UUID_LOWER : 'uuid' ;
HL7_DATETIME : 'HL7datetime' ;
ISO8601_DATETIME : 'ISO8601datetime' ;
RFC822_DATETIME : 'RFC822datetime' ;
SUBSTITUTION_XPATH : X P A T H -> mode(CST_MODE) ;
SUBSTITUTION_REGEXP : R E G '_' E X P ;
LITERAL : 'Literal' -> mode(ANNOTATION_MODE) ;
PROPERTY : 'Property' ;
CLASS : 'Class' ;
// Expression types (case insensitive)
XPATHEQUALS : X P A T H E Q U A L S -> mode(CST_MODE);
XPATHNOTEQUALS : X P A T H N O T E Q U A L S -> mode(CST_MODE);
XSLT : X S L T ;
CONTAINS : C O N T A I N S -> mode(CST_MODE);
NOTCONTAINS : N O T C O N T A I N S -> mode(CST_MODE);
ALWAYS : A L W A Y S ;
NEVER : N E V E R ;
XPATHEXISTS : X P A T H E X I S T S -> mode(CST_MODE);
XPATHNOTEXISTS : X P A T H N O T E X I S T S -> mode(CST_MODE) ;
XPATHCOMPARE : X P A T H C O M P A R E -> mode(CST_MODE);
XPATHNOTCOMPARE : X P A T H N O T C O M P A R E -> mode(CST_MODE);
XPATHIN : X P A T H I N -> mode(CST_MODE);
XPATHNOTIN : X P A T H N O T I N -> mode(CST_MODE);
XPATHMATCHES : X P A T H M A T C H E S -> mode(CST_MODE);
XPATHNOTMATCHES : X P A T H N O T M A T C H E S -> mode(CST_MODE);
SCHEMA : S C H E M A ;
MATCHES : M A T C H E S ;
NOTMATCHES : N O T M A T C H E S ;
// match sources
CONTEXT_PATH : C O N T E X T '_' P A T H ; // text only
CONTENT : C O N T E N T ; // xml and text
HTTP_HEADER : H T T P '_' H E A D E R ; // text only
JWT_HEADER : J W T '_' H E A D E R ; // xml and text
JWT_PAYLOAD : J W T '_' P A Y L O A D ; // xml and text
MESH_CTL : M E S H '_' C T L; // xml and text
MESH_DAT : M E S H '_' D A T; // xml and text
FIRST : F I R S T ;
ALL : A L L ;
//------------------------------------------------------------------------------
// one liners
PLUS : '+' ;
NEXT : N E X T ;
AND : A N D ;
OR : O R ;
NOT : N O T ;
EQUALS : '=' ;
fragment DOLLAR : '$' ;
WITH_HTTP_HEADERS : W I T H '_' H T T P '_' H E A D E R S ;
//------------------------------------------------------------------------------
// Begin end blocks
fragment RESPONSES : 'RESPONSES' ;
fragment SUBSTITUTIONS : 'SUBSTITUTIONS' ;
fragment EXPRESSIONS : 'EXPRESSIONS' ;
fragment RULE : 'RULE' ;
//------------------------------------------------------------------------------
BEGIN_RESPONSES : BEGIN_TOKEN SPACES RESPONSES ;
END_RESPONSES : END_TOKEN SPACES RESPONSES ;
BEGIN_SUBSTITUTIONS : BEGIN_TOKEN SPACES SUBSTITUTIONS ;
END_SUBSTITUTIONS : END_TOKEN SPACES SUBSTITUTIONS ;
BEGIN_EXPRESSIONS : BEGIN_TOKEN SPACES EXPRESSIONS ;
END_EXPRESSIONS : END_TOKEN SPACES EXPRESSIONS ;
BEGIN_RULE : BEGIN_TOKEN SPACES RULE ;
END_RULE : END_TOKEN SPACES RULE ;
//------------------------------------------------------------------------------
VARIABLE_NAME : DOLLAR IDENTIFIER ;
// adding the colon means we can include urns as IDENTIFIER s
IDENTIFIER : ( ALPHA | DIGIT | [_-] | ':' | '%' ) + ;
// adds unix file path separator and period
fragment EXTENDED_IDENTIFIER : IDENTIFIER | DOT | [/] ;
DOT_SEPARATED_IDENTIFIER : IDENTIFIER ( DOT IDENTIFIER )* ;
fragment PROTOCOL : 'http' | 'https' | 'spine' ;
URL : PROTOCOL '://' EXTENDED_IDENTIFIER+ ;
URI : ( ALPHA | DIGIT | [_-] | ':' | '%' | '?' | EQUALS | DOT ) + ;
/* Generally a file path but used elsewhere handles optional dos volume prefix */
PATH : (ALPHA ':')? ( EXTENDED_IDENTIFIER | '\\' ) + ;
// we are currently constrained to xpath expressions which do not contain spaces
XPATH : ( EXTENDED_IDENTIFIER | [@'()\[\]*=\"] | LPAREN | RPAREN ) + ;
// added & as a valid regexp character
REGEXP : ( XPATH | '^' | '$' | '\\' | '{' | '}' | '?' | '|' | ',' | PLUS | '&' ) + ;
// take everything up to the next linefeed
mode ANNOTATION_MODE ;
// Strips leading whitespace before returning the token value
ANNOTATION_TEXT : ( ~ ('\r' | '\n' ) ) + {setText(getText().replaceFirst("^[\t ]*",""));
if (DEBUG) System.out.println("ANNOTATION_TEXT ="+getText());
} -> mode(DEFAULT_MODE) ;
//------------------------------------------------------------------------------
// This mode is analagous to the ConfigurationStringTokenizer which honours matching brackets and quotes
mode CST_MODE ;
SP : [ \t]+ -> channel(HIDDEN);
CST : (
( ( NOSPACESORDELIMS* ( '(' CSTORSPACE ')' | '[' CSTORSPACE ']' | '\'' ~[\']* '\'' | '"' ~["]* '"' ) + NOSPACESORDELIMS* ) + |
NOSPACESORDELIMS+
) {if ( DEBUG ) System.out.println("Returning ["+getText()+"]"); }
) ;
fragment CSTORSPACE : ( CST | ' ' | '\\' )* ; // Bodge to trap \
fragment NOSPACESORDELIMS : ~[\[\"'(\]) \t\r\n] | '\\' ; // Bodge to trap \
LF : ('\r' | '\n')+ -> channel(HIDDEN), mode(DEFAULT_MODE) ;
//------------------------------------------------------------------------------
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca_notsx.log_22_867.asm | ljhsiun2/medusa | 9 | 16100 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x10e82, %rsi
lea addresses_WC_ht+0xed6c, %rdi
nop
add $31064, %r14
mov $91, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp $15261, %rbx
lea addresses_UC_ht+0x18086, %rbp
nop
nop
xor %r10, %r10
mov $0x6162636465666768, %rbx
movq %rbx, %xmm6
vmovups %ymm6, (%rbp)
nop
nop
sub %r14, %r14
lea addresses_UC_ht+0x107c2, %rsi
lea addresses_normal_ht+0x11f82, %rdi
nop
and $29020, %r11
mov $84, %rcx
rep movsq
nop
nop
nop
cmp %r11, %r11
lea addresses_UC_ht+0xf382, %rsi
nop
nop
nop
nop
cmp %rcx, %rcx
movw $0x6162, (%rsi)
nop
inc %r10
lea addresses_WT_ht+0x17c02, %rsi
lea addresses_D_ht+0x8c04, %rdi
nop
nop
nop
nop
dec %rbp
mov $124, %rcx
rep movsl
nop
nop
nop
nop
nop
and $43813, %rcx
lea addresses_D_ht+0x17e03, %r11
nop
nop
nop
lfence
mov $0x6162636465666768, %rbp
movq %rbp, %xmm4
movups %xmm4, (%r11)
xor %r11, %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %rax
push %rcx
push %rdi
push %rdx
// Faulty Load
lea addresses_US+0x17382, %r11
nop
cmp %r15, %r15
mov (%r11), %ax
lea oracles, %rdi
and $0xff, %rax
shlq $12, %rax
mov (%rdi,%rax,1), %rax
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'00': 22}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
programs/oeis/262/A262616.asm | karttu/loda | 0 | 176151 | ; A262616: Triangle read by rows: T(n,k) = 4^(n-k), n>=0, 0<=k<=n.
; 1,4,1,16,4,1,64,16,4,1,256,64,16,4,1,1024,256,64,16,4,1,4096,1024,256,64,16,4,1,16384,4096,1024,256,64,16,4,1,65536,16384,4096,1024,256,64,16,4,1,262144,65536,16384,4096,1024,256,64,16,4,1,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,67108864,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,268435456,67108864,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,1073741824,268435456,67108864,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,4294967296,1073741824,268435456,67108864,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,17179869184,4294967296,1073741824,268435456,67108864,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,68719476736,17179869184,4294967296,1073741824,268435456,67108864,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,274877906944,68719476736,17179869184,4294967296,1073741824,268435456,67108864,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,1099511627776,274877906944,68719476736,17179869184,4294967296,1073741824,268435456,67108864,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64,16,4,1,4398046511104,1099511627776,274877906944,68719476736,17179869184,4294967296,1073741824,268435456,67108864,16777216,4194304,1048576,262144,65536,16384,4096,1024,256,64
cal $0,25676 ; Exponent of 8 (value of i) in n-th number of form 8^i*9^j.
mov $2,4
pow $2,$0
add $1,$2
mul $1,2
div $1,6
mul $1,3
add $1,1
|
test/filters-cases/bug-1285c.asm | OfekShilon/compiler-explorer | 4,668 | 6870 | <filename>test/filters-cases/bug-1285c.asm
.file "example.cpp"
.intel_syntax noprefix
.text
.Ltext0:
.globl _Z3foov
.type _Z3foov, @function
_Z3foov:
.LFB17:
.file 1 "/tmp/compiler-explorer-compiler119330-63-1ccesdf.nzyy/example.cpp"
.loc 1 3 11
.cfi_startproc
.loc 1 3 13
.loc 1 3 24 is_stmt 0
mov eax, 42
ret
.cfi_endproc
.LFE17:
.size _Z3foov, .-_Z3foov
.globl _Z3barv
.type _Z3barv, @function
_Z3barv:
.LFB18:
.loc 1 4 11 is_stmt 1
.cfi_startproc
.loc 1 4 13
.LVL0:
.LBB6:
.LBB7:
.file 2 "/opt/compiler-explorer/gcc-8.3.0/include/c++/8.3.0/typeinfo"
.loc 2 100 7
.loc 2 100 14 is_stmt 0
mov rax, QWORD PTR _ZTIi[rip+8]
.loc 2 100 31
cmp BYTE PTR [rax], 42
sete dl
movzx edx, dl
.LVL1:
.LBE7:
.LBE6:
.loc 1 4 40
movsx eax, BYTE PTR [rax+rdx]
.loc 1 4 43
ret
.cfi_endproc
.LFE18:
.size _Z3barv, .-_Z3barv
.globl _Z3bazv
.type _Z3bazv, @function
_Z3bazv:
.LFB19:
.loc 1 6 11 is_stmt 1
.cfi_startproc
.loc 1 6 13
.LVL2:
.loc 2 100 7
.loc 1 6 45 is_stmt 0
mov eax, 53
ret
.cfi_endproc
.LFE19:
.size _Z3bazv, .-_Z3bazv
.Letext0:
.file 3 "/opt/compiler-explorer/gcc-8.3.0/include/c++/8.3.0/x86_64-linux-gnu/bits/c++config.h"
.file 4 "<built-in>"
.section .debug_info,"",@progbits
.Ldebug_info0:
.long 0x153
.value 0x4
.long .Ldebug_abbrev0
.byte 0x8
.uleb128 0x1
.long .LASF4
.byte 0x4
.long .LASF5
.long .LASF6
.quad .Ltext0
.quad .Letext0-.Ltext0
.long .Ldebug_line0
.uleb128 0x2
.string "std"
.byte 0x4
.byte 0
.long 0x75
.uleb128 0x3
.long .LASF0
.byte 0x3
.value 0x104
.byte 0x41
.uleb128 0x4
.byte 0x3
.value 0x104
.byte 0x41
.long 0x38
.uleb128 0x5
.long .LASF7
.long 0x6f
.uleb128 0x6
.long .LASF8
.byte 0x2
.byte 0x63
.byte 0x11
.long .LASF9
.long 0x125
.byte 0x1
.long 0x68
.uleb128 0x7
.long 0x137
.byte 0
.byte 0
.uleb128 0x8
.long 0x4a
.byte 0
.uleb128 0x9
.long .LASF10
.byte 0x3
.value 0x106
.byte 0xb
.long 0x95
.uleb128 0x3
.long .LASF0
.byte 0x3
.value 0x108
.byte 0x41
.uleb128 0x4
.byte 0x3
.value 0x108
.byte 0x41
.long 0x82
.byte 0
.uleb128 0xa
.string "baz"
.byte 0x1
.byte 0x6
.byte 0x5
.long .LASF1
.long 0xb7
.quad .LFB19
.quad .LFE19-.LFB19
.uleb128 0x1
.byte 0x9c
.uleb128 0xb
.byte 0x4
.byte 0x5
.string "int"
.uleb128 0xc
.string "bar"
.byte 0x1
.byte 0x4
.byte 0x5
.long .LASF11
.long 0xb7
.quad .LFB18
.quad .LFE18-.LFB18
.uleb128 0x1
.byte 0x9c
.long 0x103
.uleb128 0xd
.long 0x142
.quad .LBB6
.quad .LBE6-.LBB6
.byte 0x1
.byte 0x4
.byte 0x24
.uleb128 0xe
.long 0x14c
.byte 0
.byte 0
.uleb128 0xa
.string "foo"
.byte 0x1
.byte 0x3
.byte 0x5
.long .LASF2
.long 0xb7
.quad .LFB17
.quad .LFE17-.LFB17
.uleb128 0x1
.byte 0x9c
.uleb128 0xf
.byte 0x8
.long 0x132
.uleb128 0x10
.byte 0x1
.byte 0x6
.long .LASF3
.uleb128 0x8
.long 0x12b
.uleb128 0xf
.byte 0x8
.long 0x6f
.uleb128 0x8
.long 0x137
.uleb128 0x11
.long 0x53
.long 0x14c
.byte 0x3
.uleb128 0x12
.long .LASF12
.long 0x13d
.byte 0
.byte 0
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x7
.uleb128 0x10
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0x2
.uleb128 0x39
.byte 0x1
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x3
.uleb128 0x39
.byte 0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x39
.uleb128 0xb
.uleb128 0x89
.uleb128 0x19
.byte 0
.byte 0
.uleb128 0x4
.uleb128 0x3a
.byte 0
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x39
.uleb128 0xb
.uleb128 0x18
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x5
.uleb128 0x2
.byte 0x1
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3c
.uleb128 0x19
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x6
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x39
.uleb128 0xb
.uleb128 0x6e
.uleb128 0xe
.uleb128 0x49
.uleb128 0x13
.uleb128 0x32
.uleb128 0xb
.uleb128 0x3c
.uleb128 0x19
.uleb128 0x64
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x7
.uleb128 0x5
.byte 0
.uleb128 0x49
.uleb128 0x13
.uleb128 0x34
.uleb128 0x19
.byte 0
.byte 0
.uleb128 0x8
.uleb128 0x26
.byte 0
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x9
.uleb128 0x39
.byte 0x1
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x39
.uleb128 0xb
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xa
.uleb128 0x2e
.byte 0
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x39
.uleb128 0xb
.uleb128 0x6e
.uleb128 0xe
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x7
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.byte 0
.byte 0
.uleb128 0xb
.uleb128 0x24
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0x8
.byte 0
.byte 0
.uleb128 0xc
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x39
.uleb128 0xb
.uleb128 0x6e
.uleb128 0xe
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x7
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xd
.uleb128 0x1d
.byte 0x1
.uleb128 0x31
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x7
.uleb128 0x58
.uleb128 0xb
.uleb128 0x59
.uleb128 0xb
.uleb128 0x57
.uleb128 0xb
.byte 0
.byte 0
.uleb128 0xe
.uleb128 0x5
.byte 0
.uleb128 0x31
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xf
.uleb128 0xf
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x10
.uleb128 0x24
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.byte 0
.byte 0
.uleb128 0x11
.uleb128 0x2e
.byte 0x1
.uleb128 0x47
.uleb128 0x13
.uleb128 0x64
.uleb128 0x13
.uleb128 0x20
.uleb128 0xb
.byte 0
.byte 0
.uleb128 0x12
.uleb128 0x5
.byte 0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x49
.uleb128 0x13
.uleb128 0x34
.uleb128 0x19
.byte 0
.byte 0
.byte 0
.section .debug_aranges,"",@progbits
.long 0x2c
.value 0x2
.long .Ldebug_info0
.byte 0x8
.byte 0
.value 0
.value 0
.quad .Ltext0
.quad .Letext0-.Ltext0
.quad 0
.quad 0
.section .debug_line,"",@progbits
.Ldebug_line0:
.section .debug_str,"MS",@progbits,1
.LASF1:
.string "_Z3bazv"
.LASF2:
.string "_Z3foov"
.LASF7:
.string "type_info"
.LASF10:
.string "__gnu_cxx"
.LASF3:
.string "char"
.LASF5:
.string "/tmp/compiler-explorer-compiler119330-63-1ccesdf.nzyy/example.cpp"
.LASF11:
.string "_Z3barv"
.LASF9:
.string "_ZNKSt9type_info4nameEv"
.LASF12:
.string "this"
.LASF0:
.string "__cxx11"
.LASF4:
.string "GNU C++14 8.3.0 -masm=intel -mtune=generic -march=x86-64 -g -O1"
.LASF8:
.string "name"
.LASF6:
.string "/tmp/compiler-explorer-compiler119330-63-1ccesdf.nzyy"
.ident "GCC: (Compiler-Explorer-Build) 8.3.0"
.section .note.GNU-stack,"",@progbits |
src/x86/cdef16_sse.asm | Luni-4/rav1e | 0 | 9978 | ; Copyright (c) 2017-2021, The rav1e contributors
; Copyright (c) 2021, <NAME>
; All rights reserved.
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
; was not distributed with this source code in the LICENSE file, you can
; obtain it at www.aomedia.org/license/software. If the Alliance for Open
; Media Patent License 1.0 was not distributed with this source code in the
; PATENTS file, you can obtain it at www.aomedia.org/license/patent.
%include "config.asm"
%include "ext/x86/x86inc.asm"
%ifn ARCH_X86_64
SECTION_RODATA 16
pq_dir_shr: dq 2, 4
%endif
SECTION .text
cextern cdef_dir_8bpc_ssse3
INIT_XMM ssse3
cglobal cdef_dir_16bpc, 2, 4, 4, 32 + 8*8, src, ss, var, bdmax
bsr bdmaxd, bdmaxm
%if ARCH_X86_64
movzx bdmaxq, bdmaxw
sub bdmaxq, 7
movq m4, bdmaxq
%else
push r4
sub bdmaxd, 9
LEA r4, pq_dir_shr
movq m4, [r4 + bdmaxd*4]
pop r4
%endif
DEFINE_ARGS src, ss, var, ss3
lea ss3q, [ssq*3]
mova m0, [srcq + ssq*0]
mova m1, [srcq + ssq*1]
mova m2, [srcq + ssq*2]
mova m3, [srcq + ss3q]
psraw m0, m4
psraw m1, m4
psraw m2, m4
psraw m3, m4
packuswb m0, m1
packuswb m2, m3
mova [rsp + 32 + 0*8], m0
mova [rsp + 32 + 2*8], m2
lea srcq, [srcq + ssq*4]
mova m0, [srcq + ssq*0]
mova m1, [srcq + ssq*1]
mova m2, [srcq + ssq*2]
mova m3, [srcq + ss3q]
psraw m0, m4
psraw m1, m4
psraw m2, m4
psraw m3, m4
packuswb m0, m1
packuswb m2, m3
mova [rsp + 32 + 4*8], m0
mova [rsp + 32 + 6*8], m2
lea srcq, [rsp + 32] ; WIN64 shadow space
mov ssq, 8
%if ARCH_X86_64
call mangle(private_prefix %+ _cdef_dir_8bpc %+ SUFFIX)
%else
movifnidn vard, varm
push eax ; align stack
push vard
push ssd
push srcd
call mangle(private_prefix %+ _cdef_dir_8bpc)
add esp, 0x10
%endif
RET
|
1581/64tass/blk.asm | silverdr/assembly | 23 | 169641 | <gh_stars>10-100
; user commands
user ldy cmdbuf+1
cpy #'0'
bne us10 ; 0 resets pntr
lda cmdsiz ; check command size
cmp #3
bcc usrint
sei
lda cmdbuf+2 ; get command
sta switch ; save info
and #$1f
tax ; command info
asl a
tay
lda cmdtbb,y
sta ip
lda cmdtbb+1,y
sta ip+1
jsr setlds ; set leds
lda fsflag ; clear clock bit
and #all-clkin
sta fsflag
jsr burst_doit
jmp endcmd
burst_doit
jmp (ip)
usrint
lda #<ublock ; set default block add
sta usrjmp
lda #>ublock
sta usrjmp+1
unused rts
us10
jsr usrexc ; execute code by table
jmp endcmd
usrexc
dey ; entry is (((index-1)and$f)*2)
tya
and #$f
asl a
tay
lda (usrjmp),y
sta ip
iny
lda (usrjmp),y
sta ip+1
jmp (ip)
; open direct access buffer
; from open "#"
opnblk lda sa ; sa is destroyed by this patch
pha
jsr autoi ; init disk for proper channel assignment
pla ; restore sa
sta sa
ldx cmdsiz
dex
bne ob10
lda #1 ; get any buffer
jsr getrch
jmp ob30
ob05 lda #nochnl
jmp cmderr
ob10 ldy #1 ; buffer # is requested
jsr bp05
ldx filsec
cpx #bfcnt+1 ; must be less than or equal to buffer count
bcs ob05
lda #0
sta temp
sec
ob15 rol temp
dex
bpl ob15
lda temp
and bufuse
bne ob05 ; buffer is used
lda temp
ora bufuse ; set buffer as used
sta bufuse
lda #0 ; set up channel
jsr getrch
ldx lindx
lda filsec
sta buf0,x
tax
lda #0
sta jobs,x
sta lstjob,x
ob30 ldx sa
lda lintab,x ; set lindx table
ora #$40
sta lintab,x
ldy lindx
lda #$ff
sta lstchr,y
lda #rndrdy
sta chnrdy,y ; set channel ready
lda buf0,y
sta chndat,y ; buffer # as 1st char
asl a
tax
lda #1
sta buftab,x
lda #dirtyp+dirtyp
sta filtyp,y ; set direct file type
jmp endcmd
block ldy #0 ; block commands
ldx #0
lda #'-' ; separates cmd from subcmd
jsr parse ; locate sub-cmd
bne blk40
blk10 lda #badcmd
jmp cmderr
blk30 lda #badsyn
jmp cmderr
blk40 txa
bne blk30
ldx #nbcmds-1 ; find command
lda cmdbuf,y
blk50 cmp bctab,x
beq blk60
dex
bpl blk50
bmi blk10
blk60 txa
ora #$80
sta cmdnum
jsr blkpar ; parse parms
lda cmdnum
asl a
tax
lda bcjmp+1,x
sta temp+1
lda bcjmp,x
sta temp
jmp (temp) ; goto command
blkpar ldy #0 ; parse block parms
ldx #0
lda #':'
jsr parse
bne bp05 ; found ":"
ldy #3 ; else char #3 is beginning
bp05 lda cmdbuf,y
cmp #' '
beq bp10
cmp #29 ; skip character
beq bp10
cmp #','
bne bp20
bp10 iny
cpy cmdsiz
bcc bp05
rts ; that's all
bp20 jsr aschex
inc f1cnt
ldy f2ptr
cpx #mxfils-1
bcc bp10
bcs blk30 ; bad syntax
; convert ascii to hex (binary)
; & store conversion in tables
; .y= ptr into cmdbuf
aschex lda #0
sta temp
sta temp+1
sta temp+3
ldx #$ff
ah10 lda cmdbuf,y ; test for dec #
cmp #$40
bcs ah20 ; non-numeric terminates
cmp #$30
bcc ah20 ; non-numeric
and #$f
pha
lda temp+1 ; shift digits (*10)
sta temp+2
lda temp
sta temp+1
pla
sta temp
iny
cpy cmdsiz
bcc ah10 ; still in string
ah20 sty f2ptr ; convert digits to...
clc ; ...binary by dec table
lda #0
ah30 inx
cpx #3
bcs ah40
ldy temp,x
ah35 dey
bmi ah30
adc dectab,x
bcc ah35
clc
inc temp+3
bne ah35
ah40 pha
ldx f1cnt
lda temp+3
sta filtrk,x ; store result in table
pla
sta filsec,x
rts
dectab .byte 1,10,100 ; decimal table
blkfre jsr autoi ; init if neccessary
jsr blktst ; block-free
jsr frets
jmp endsav
blkalc jsr autoi ; init if neccessary
jsr blktst
lda sector
pha
jsr getsec
beq ba15 ; none greater this trk
pla
cmp sector
bne ba30 ; requested sec not avail
jsr wused
jmp endsav
ba15 pla ; pop stack
ba20 lda #0
sta sector
inc track
lda track
cmp maxtrk
bcs ba40 ; gone all the way
jsr getsec
beq ba20
ba30 lda #noblk
jsr cmder2
ba40 lda #noblk
jsr cmderr ; t=0,s=0 :none left
; block read subs
blkrd2 jsr bkotst ; test parms
jmp drtrd
getsim jsr getpre ; get byte w/o inc
lda (buftab,x)
rts
; block read
blkrd3 jsr blkrd2
blkrd4 lda #0
jsr setpnt
jsr getsim ; y=lindx
sta lstchr,y
lda #rndrdy
sta chnrdy,y
rts
blkrd jsr blkrd3
jsr rnget1
jmp endcmd
;user direct read, lstchr=$ff
xublkrd jsr xbkotst
jsr drtrd
jsr blkrd4
jmp ublkrd1
ublkrd jsr blkpar
jsr blkrd3
ublkrd1 lda lstchr,y
sta chndat,y
lda #$ff
sta lstchr,y
jmp endcmd ; (rts)
;block-write
blkwt jsr bkotst
jsr getpnt
tay
dey
cmp #2
bcs bw10
ldy #1
bw10 lda #0 ; set record size
jsr setpnt
tya
jsr putbyt
txa
pha
jsr drtwrt ; write block
pla
tax
ldy lindx
jmp blkp4
;user dirct write, no lstchr, no ts check
xublkwt jsr xbkotst
jmp ublkwt1
;user dirct write, no lstchr
ublkwt jsr blkpar
jsr bkotst
ublkwt1 jsr drtwrt
jmp endcmd
;in .file vector:
blkexc jsr blkrd2 ; read block & execute
lda #0
sta temp
ldx jobnum
lda bufind,x
sta temp+1
jsr be10 ; indirect jsr
jmp endcmd
be10 jmp (temp)
blkptr jsr buftst ; set buffer pointer
lda jobnum
asl a
tax
lda filsec+1
sta buftab,x
jsr getpre
blkp4 jsr rnget2 ; set up get
jmp endcmd
buftst ldx f1ptr ; test allocated buf
inc f1ptr ; ...related to sa
lda filsec,x
tay
dey
dey
cpy #$d ; set limit to # of sas
bcc bt20
bt15 lda #nochnl
jmp cmderr
bt20 sta sa
jsr fndrch
bcs bt15
jsr getact
sta jobnum
rts
bkotst jsr buftst ; test parms
blktst ldx f1ptr ; test legal block and
lda filsec+2,x
sta sector
lda filsec+1,x
sta track
jsr tschk
jmp setlds ; (rts)
xbkotst jsr buftst ; test parms
ldx f1ptr ; set track and sector
lda filsec+2,x
sta sector
lda filsec+1,x
sta track
jsr setlds
lda #bit6
sta jobrtn
rts
allocbuf
ora bufuse
sta bufuse
rts
bctab .text 'AFRWEP',$d2,$d7,'?','*'
nbcmds =*-bctab
bcjmp
.word blkalc ; block-allocate
.word blkfre ; block-free
.word blkrd ; block-read
.word blkwt ; block-write
.word blkexc ; block-execute
.word blkptr ; block-pointer
.word xublkrd ; user read no tschk
.word xublkwt ; user write no tschk
.word blkme
.word blkwif
blkme lda #$79
jmp errts0
blkwif lda #$7a
jmp errts0
|
oeis/139/A139107.asm | neoneye/loda-programs | 11 | 174628 | <gh_stars>10-100
; A139107: Bisection of A139102.
; Submitted by <NAME>(s4)
; 1,9,599,38359,2454999,628479869,643563386359,41188056726999,168706280353789919,43188807770570219359,2764083697316494039005,2830421706052089895941623,46373629231957440855107559295
mul $0,2
seq $0,6093 ; a(n) = prime(n) - 1.
seq $0,118255 ; a(1)=1, then a(n)=2*a(n-1) if n is prime, a(n)=2*a(n-1)+1 if n not prime.
div $0,2
|
Classes/alias/info for/size/size of (info for (path to me)).applescript | looking-for-a-job/applescript-examples | 1 | 2059 | #!/usr/bin/osascript
size of (info for (path to me)) |
oeis/272/A272887.asm | neoneye/loda-programs | 11 | 168969 | <filename>oeis/272/A272887.asm
; A272887: Number of ways to write prime(n) as (4*x + 2)*y + 4*x + 1 where x and y are nonnegative integers.
; Submitted by <NAME>
; 0,1,2,1,2,2,3,2,2,4,1,2,4,2,2,4,4,2,2,3,2,2,4,6,3,4,2,4,4,4,1,4,4,4,6,2,2,2,4,4,6,4,2,2,6,3,2,2,4,4,6,4,3,6,4,4,8,2,2,4,2,6,4,4,2,4,2,3,4,6,4,6,2,4,4,2,8,2,4,4,8,2,4,4,4,4,9,2,8,2,6,4,2,4,4,6,8,6,2,2
lpb $0
seq $0,6005 ; The odd prime numbers together with 1.
seq $0,1227 ; Number of odd divisors of n.
mov $1,$0
lpb $0
sub $0,$1
lpe
lpe
mov $0,$1
|
Transynther/x86/_processed/US/_zr_/i3-7100_9_0x84_notsx.log_21829_2073.asm | ljhsiun2/medusa | 9 | 247371 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xc2c7, %rcx
and %r10, %r10
mov (%rcx), %r13
nop
nop
nop
add %r10, %r10
lea addresses_D_ht+0x2ac7, %rsi
lea addresses_WT_ht+0x6ac7, %rdi
nop
nop
nop
nop
nop
and %r11, %r11
mov $127, %rcx
rep movsl
nop
nop
cmp %r10, %r10
lea addresses_D_ht+0x18fa7, %rsi
lea addresses_A_ht+0x8c7, %rdi
nop
nop
nop
and %r9, %r9
mov $79, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_D_ht+0xcac7, %rsi
lea addresses_WC_ht+0x8ac7, %rdi
nop
nop
nop
nop
and $10413, %r13
mov $36, %rcx
rep movsw
nop
add %r10, %r10
lea addresses_D_ht+0xe27, %rcx
nop
nop
nop
add $23176, %r9
mov $0x6162636465666768, %rdi
movq %rdi, %xmm7
movups %xmm7, (%rcx)
nop
nop
nop
cmp %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r14
push %r8
push %r9
push %rbx
// Load
lea addresses_US+0xabc7, %r14
nop
nop
cmp $38740, %rbx
movups (%r14), %xmm1
vpextrq $0, %xmm1, %r11
nop
nop
nop
nop
add %rbx, %rbx
// Store
lea addresses_normal+0x16de7, %r9
nop
nop
sub %r8, %r8
mov $0x5152535455565758, %r12
movq %r12, %xmm7
vmovups %ymm7, (%r9)
nop
nop
nop
nop
nop
and $6096, %r12
// Store
lea addresses_WC+0x1c151, %rbx
nop
nop
nop
and %r12, %r12
movw $0x5152, (%rbx)
inc %r10
// Store
lea addresses_D+0xb627, %r8
nop
nop
sub %r10, %r10
mov $0x5152535455565758, %r14
movq %r14, %xmm0
vmovups %ymm0, (%r8)
nop
nop
inc %rbx
// Faulty Load
lea addresses_US+0xd2c7, %r11
clflush (%r11)
nop
cmp $26545, %r14
movups (%r11), %xmm3
vpextrq $0, %xmm3, %rbx
lea oracles, %r12
and $0xff, %rbx
shlq $12, %rbx
mov (%r12,%rbx,1), %rbx
pop %rbx
pop %r9
pop %r8
pop %r14
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_US', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
gcc-gcc-7_3_0-release/gcc/ada/spark_xrefs_test.adb | best08618/asylo | 7 | 8474 | ------------------------------------------------------------------------------
-- --
-- GNAT SYSTEM UTILITIES --
-- --
-- S P A R K _ X R E F S _ T E S T --
-- --
-- B o d y --
-- --
-- Copyright (C) 2011-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This utility program is used to test proper operation of the
-- Get_SPARK_Xrefs and Put_SPARK_Xrefs units. To run it, compile any source
-- file with switch -gnatd.E or -gnatd.F to get an ALI file file.ALI
-- containing SPARK information. Then run this utility using:
-- spark_xrefs_test file.ali
-- This test will read the SPARK cross-reference information from the ALI
-- file, and use Get_SPARK_Xrefs to store this in binary form in the internal
-- tables in SPARK_Xrefs. Then Put_SPARK_Xrefs is used to write the
-- information from these tables back into text form. This output is compared
-- with the original SPARK cross-reference information in the ALI file and the
-- two should be identical. If not an error message is output.
with Get_SPARK_Xrefs;
with Put_SPARK_Xrefs;
with SPARK_Xrefs; use SPARK_Xrefs;
with Types; use Types;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Streams; use Ada.Streams;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
with Ada.Text_IO;
with GNAT.OS_Lib; use GNAT.OS_Lib;
procedure SPARK_Xrefs_Test is
Infile : File_Type;
Name1 : String_Access;
Outfile_1 : File_Type;
Name2 : String_Access;
Outfile_2 : File_Type;
C : Character;
Stop : exception;
-- Terminate execution
Diff_Exec : constant String_Access := Locate_Exec_On_Path ("diff");
Diff_Result : Integer;
use ASCII;
begin
if Argument_Count /= 1 then
Ada.Text_IO.Put_Line ("Usage: spark_xrefs_test FILE.ali");
raise Stop;
end if;
Name1 := new String'(Argument (1) & ".1");
Name2 := new String'(Argument (1) & ".2");
Open (Infile, In_File, Argument (1));
Create (Outfile_1, Out_File, Name1.all);
Create (Outfile_2, Out_File, Name2.all);
-- Read input file till we get to first 'F' line
Process : declare
Output_Col : Positive := 1;
function Get_Char (F : File_Type) return Character;
-- Read one character from specified file
procedure Put_Char (F : File_Type; C : Character);
-- Write one character to specified file
function Get_Output_Col return Positive;
-- Return current column in output file, where each line starts at
-- column 1 and terminate with LF, and HT is at columns 1, 9, etc.
-- All output is supposed to be carried through Put_Char.
--------------
-- Get_Char --
--------------
function Get_Char (F : File_Type) return Character is
Item : Stream_Element_Array (1 .. 1);
Last : Stream_Element_Offset;
begin
Read (F, Item, Last);
if Last /= 1 then
return Types.EOF;
else
return Character'Val (Item (1));
end if;
end Get_Char;
--------------------
-- Get_Output_Col --
--------------------
function Get_Output_Col return Positive is
begin
return Output_Col;
end Get_Output_Col;
--------------
-- Put_Char --
--------------
procedure Put_Char (F : File_Type; C : Character) is
Item : Stream_Element_Array (1 .. 1);
begin
if C /= CR and then C /= EOF then
if C = LF then
Output_Col := 1;
elsif C = HT then
Output_Col := ((Output_Col + 6) / 8) * 8 + 1;
else
Output_Col := Output_Col + 1;
end if;
Item (1) := Character'Pos (C);
Write (F, Item);
end if;
end Put_Char;
-- Subprograms used by Get_SPARK_Xrefs (these also copy the output to
-- Outfile_1 for later comparison with the output generated by
-- Put_SPARK_Xrefs).
function Getc return Character;
function Nextc return Character;
procedure Skipc;
----------
-- Getc --
----------
function Getc return Character is
C : Character;
begin
C := Get_Char (Infile);
Put_Char (Outfile_1, C);
return C;
end Getc;
-----------
-- Nextc --
-----------
function Nextc return Character is
C : Character;
begin
C := Get_Char (Infile);
if C /= EOF then
Set_Index (Infile, Index (Infile) - 1);
end if;
return C;
end Nextc;
-----------
-- Skipc --
-----------
procedure Skipc is
C : Character;
pragma Unreferenced (C);
begin
C := Getc;
end Skipc;
-- Subprograms used by Put_SPARK_Xrefs, which write information to
-- Outfile_2.
function Write_Info_Col return Positive;
procedure Write_Info_Char (C : Character);
procedure Write_Info_Initiate (Key : Character);
procedure Write_Info_Nat (N : Nat);
procedure Write_Info_Terminate;
--------------------
-- Write_Info_Col --
--------------------
function Write_Info_Col return Positive is
begin
return Get_Output_Col;
end Write_Info_Col;
---------------------
-- Write_Info_Char --
---------------------
procedure Write_Info_Char (C : Character) is
begin
Put_Char (Outfile_2, C);
end Write_Info_Char;
-------------------------
-- Write_Info_Initiate --
-------------------------
procedure Write_Info_Initiate (Key : Character) is
begin
Write_Info_Char (Key);
end Write_Info_Initiate;
--------------------
-- Write_Info_Nat --
--------------------
procedure Write_Info_Nat (N : Nat) is
begin
if N > 9 then
Write_Info_Nat (N / 10);
end if;
Write_Info_Char (Character'Val (48 + N mod 10));
end Write_Info_Nat;
--------------------------
-- Write_Info_Terminate --
--------------------------
procedure Write_Info_Terminate is
begin
Write_Info_Char (LF);
end Write_Info_Terminate;
-- Local instantiations of Put_SPARK_Xrefs and Get_SPARK_Xrefs
procedure Get_SPARK_Xrefs_Info is new Get_SPARK_Xrefs;
procedure Put_SPARK_Xrefs_Info is new Put_SPARK_Xrefs;
-- Start of processing for Process
begin
-- Loop to skip till first 'F' line
loop
C := Get_Char (Infile);
if C = EOF then
raise Stop;
elsif C = LF or else C = CR then
loop
C := Get_Char (Infile);
exit when C /= LF and then C /= CR;
end loop;
exit when C = 'F';
end if;
end loop;
-- Position back to initial 'F' of first 'F' line
Set_Index (Infile, Index (Infile) - 1);
-- Read SPARK cross-reference information to internal SPARK tables, also
-- copying SPARK xrefs info to Outfile_1.
Initialize_SPARK_Tables;
Get_SPARK_Xrefs_Info;
-- Write SPARK cross-reference information from internal SPARK tables to
-- Outfile_2.
Put_SPARK_Xrefs_Info;
-- Junk blank line (see comment at end of Lib.Writ)
Write_Info_Terminate;
-- Flush to disk
Close (Outfile_1);
Close (Outfile_2);
-- Now Outfile_1 and Outfile_2 should be identical
Diff_Result :=
Spawn (Diff_Exec.all,
Argument_String_To_List
("-u " & Name1.all & " " & Name2.all).all);
if Diff_Result /= 0 then
Ada.Text_IO.Put_Line ("diff(1) exit status" & Diff_Result'Img);
end if;
OS_Exit (Diff_Result);
end Process;
exception
when Stop =>
null;
end SPARK_Xrefs_Test;
|
programs/oeis/014/A014447.asm | neoneye/loda | 22 | 5849 | ; A014447: Odd Lucas numbers.
; 1,3,7,11,29,47,123,199,521,843,2207,3571,9349,15127,39603,64079,167761,271443,710647,1149851,3010349,4870847,12752043,20633239,54018521,87403803,228826127,370248451,969323029,1568397607,4106118243
mov $2,$0
div $0,2
add $2,$0
mov $1,$2
seq $1,204 ; Lucas numbers (beginning with 1): L(n) = L(n-1) + L(n-2) with L(1) = 1, L(2) = 3.
mov $0,$1
|
14-Intro-to-Shredding.size.asm | blueset/7bh-solutions | 0 | 174713 | <reponame>blueset/7bh-solutions<gh_stars>0
-- 7 Billion Humans --
-- 14: Intro to Shredding --
-- Size: 4/4 --
-- Speed: 4/3 --
step s
pickup c
step s
giveto s
|
source/xml/templates/xml-templates-processors.ads | svn2github/matreshka | 24 | 21717 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2013-2015, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
private with Ada.Containers.Hashed_Maps;
with League.Holders;
with League.Strings;
private with League.Strings.Hash;
private with XML.SAX.Attributes;
with XML.SAX.Content_Handlers;
with XML.SAX.Lexical_Handlers;
private with XML.SAX.Locators;
with XML.SAX.Readers;
private with XML.Utilities.Namespace_Supports;
private with XML.Templates.Streams;
package XML.Templates.Processors is
type Template_Processor is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler
and XML.SAX.Lexical_Handlers.SAX_Lexical_Handler with private;
procedure Set_Content_Handler
(Self : in out Template_Processor'Class;
Handler : XML.SAX.Readers.SAX_Content_Handler_Access);
procedure Set_Lexical_Handler
(Self : in out Template_Processor'Class;
Handler : XML.SAX.Readers.SAX_Lexical_Handler_Access);
procedure Set_Parameter
(Self : in out Template_Processor'Class;
Name : League.Strings.Universal_String;
Value : League.Holders.Holder);
private
package String_Holder_Maps is
new Ada.Containers.Hashed_Maps
(League.Strings.Universal_String,
League.Holders.Holder,
League.Strings.Hash,
League.Strings."=",
League.Holders."=");
type Boolean_Stack is mod 2 ** 64;
procedure Push (Self : in out Boolean_Stack; Value : Boolean);
procedure Pop (Self : in out Boolean_Stack; Value : out Boolean);
type Template_Processor is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler
and XML.SAX.Lexical_Handlers.SAX_Lexical_Handler with record
Diagnosis : League.Strings.Universal_String;
Content_Handler : XML.SAX.Readers.SAX_Content_Handler_Access;
Lexical_Handler : XML.SAX.Readers.SAX_Lexical_Handler_Access;
Locator : XML.SAX.Locators.SAX_Locator;
Namespaces : XML.Utilities.Namespace_Supports.XML_Namespace_Support;
Parameters : String_Holder_Maps.Map;
Stream :
XML.Templates.Streams.XML_Stream_Element_Vectors.Vector;
Accumulate : Natural := 0;
Skip : Natural := 0;
-- Skip all events. Used to process 'if' directive.
Run_Else : Boolean := False;
-- All conditions on current 'if' level are evaluated to False
Run_Else_Stack : Boolean_Stack := 0;
-- Stack of Run_Else values
Accumulated_Text : League.Strings.Universal_String;
-- Character data is accumulated in this member to simplify processing.
Object_Name : League.Strings.Universal_String;
Container_Value : League.Holders.Holder;
end record;
-- Override SAX event handling subprogram.
overriding procedure Characters
(Self : in out Template_Processor;
Text : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Comment
(Self : in out Template_Processor;
Text : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure End_CDATA
(Self : in out Template_Processor;
Success : in out Boolean);
overriding procedure End_Document
(Self : in out Template_Processor;
Success : in out Boolean);
overriding procedure End_DTD
(Self : in out Template_Processor;
Success : in out Boolean);
overriding procedure End_Element
(Self : in out Template_Processor;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure End_Prefix_Mapping
(Self : in out Template_Processor;
Prefix : League.Strings.Universal_String;
Success : in out Boolean);
overriding function Error_String
(Self : Template_Processor) return League.Strings.Universal_String;
overriding procedure Ignorable_Whitespace
(Self : in out Template_Processor;
Text : League.Strings.Universal_String;
Success : in out Boolean) renames Characters;
overriding procedure Processing_Instruction
(Self : in out Template_Processor;
Target : League.Strings.Universal_String;
Data : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Set_Document_Locator
(Self : in out Template_Processor;
Locator : XML.SAX.Locators.SAX_Locator);
overriding procedure Start_CDATA
(Self : in out Template_Processor;
Success : in out Boolean);
overriding procedure Start_Document
(Self : in out Template_Processor;
Success : in out Boolean);
overriding procedure Start_DTD
(Self : in out Template_Processor;
Name : League.Strings.Universal_String;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Start_Element
(Self : in out Template_Processor;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean);
overriding procedure Start_Prefix_Mapping
(Self : in out Template_Processor;
Prefix : League.Strings.Universal_String;
Namespace_URI : League.Strings.Universal_String;
Success : in out Boolean);
end XML.Templates.Processors;
|
drivers/pendulum.adb | sciencylab/lagrangian-solver | 0 | 21224 | <reponame>sciencylab/lagrangian-solver
with Numerics, Ada.Text_IO, Chebyshev, Dense_AD, Dense_AD.Integrator;
use Numerics, Ada.Text_IO, Chebyshev;
procedure Pendulum is
use Int_IO, Real_IO, Real_Functions;
-----------------------------------------------
N : constant Nat := 1;
K : constant Nat := 7;
Num : constant Nat := 2 * N;
-----------------------------------------------
package AD_Package is new Dense_AD (Num);
package Integrator is new AD_Package.Integrator (K);
use AD_Package, Integrator;
-----------------------------------------------
Control : Control_Type := New_Control_Type (Tol => 1.0e-10);
-----------------------------------------------
function Lagrangian (T : in Real;
X : in Vector) return AD_Type is
Q : AD_Vector := Var (X);
θ : AD_Type renames Q (1);
ω : AD_Type renames Q (2);
M : Real := 2.0;
L : Real := 1.0;
G : Real := 10.0;
begin
return (0.5 * M * L**2) * (ω ** 2) - M * G * (1.0 - Sin (θ));
end Lagrangian;
-----------------------------------------------
-- Initial Conditions ----
Var : Variable;
State : Variable;
θ : Real renames State.X (1);
ω : Real renames State.X (2);
-------------------------------
Y : Real_Vector (1 .. Num * K);
A : Array_Of_Vectors;
File, Phase : File_Type;
Input : File_Type;
Dt : constant Real := 0.01;
T_Final : Real := 10.0;
Line : String (1 .. 50);
Last : Natural;
begin
-- Read initial conditions
Get_Line (Line, Last); -- Not used
Get_Line (Line, Last); -- T0
Var.T := Real'Value (Line (1 .. Last));
Get_Line (Line, Last); -- theta_0
Var.X (1) := Real'Value (Line (1 .. Last));
Get_Line (Line, Last); -- omega_0
Var.X (2) := Real'Value (Line (1 .. Last));
Get_Line (Line, Last); -- Not used
Get_Line (Line, Last); -- T_final
T_Final := Real'Value (Line (1 .. Last));
------------------------------------------------------------
Create (File, Name => "pendulum.csv");
Put_Line (File, "time, x, u, y, v");
Create (Phase, Name => "phase.csv");
Put_Line (Phase, "time, q, q_dot, p, H");
State := Var;
while Var.T < T_Final loop
Y := Update (Lagrangian'Access, Var, Control, Sparse);
A := Chebyshev_Transform (Y);
while State.T <= Var.T + Control.Dt loop
State.T := State.T + Dt;
State.X := Interpolate (A, State.T, Var.T, Var.T + Control.Dt);
-- Print data --------------------------------------------------
Print_Lagrangian (Phase, State, Lagrangian'Access, 2, 3, 2);
Put (File, State.T); Put (File, ", ");
Put (File, Cos (θ)); Put (File, ", ");
Put (File, -ω * Sin (θ)); Put (File, ", ");
Put (File, 1.0 - Sin (θ)); Put (File, ", ");
Put (File, -ω * Cos (θ)); New_Line (File);
----------------------------------------------------------------
end loop;
Update (Var => Var, Y => Y, Dt => Control.Dt); -- Update variable Var
end loop;
Close (File);
Close (Phase);
end Pendulum;
|
sanity-checking/tests/0004-ada-shared-lib/lib_src/lib_pack.ads | reznikmm/GNAT-FSF-builds | 5 | 26629 | package Lib_Pack is
procedure Test;
end Lib_Pack;
|
sum-thms.agda | logicshan/IAL | 0 | 11840 | module sum-thms where
open import eq
open import sum
open import list
open import product
inj₁-inj : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'}{x : A}{x'} → inj₁{ℓ}{ℓ'}{A}{B} x ≡ inj₁ x' → x ≡ x'
inj₁-inj refl = refl
|
oeis/226/A226140.asm | neoneye/loda-programs | 11 | 100037 | <filename>oeis/226/A226140.asm<gh_stars>10-100
; A226140: a(n) = Sum_{i=1..floor(n/2)} (n-i)^i.
; 0,1,2,7,13,48,95,424,898,4837,10780,68399,158111,1156224,2745145,22744380,55098660,510307001,1255610350,12859037607,32030878113,359498491968,904385401323,11040700820704,28000658588542,369448856494637,943286005157112,13377869443112975,34350099839952635,521140476854109280,1344558381255214197,21730508231342435060,56296743553083829808,965667667640802787937,2510671240695775345754,45557042163021386531655,118814531872813532144781,2273906222022847158541888,5946688105900093417573943
mov $2,$0
lpb $0
mov $0,$2
add $3,1
div $0,$3
mov $4,$0
sub $0,$3
add $2,$0
mov $5,$4
pow $5,$3
add $6,$5
lpe
mov $0,$6
|
EPASMX86_64/Primes.asm | JoshuaWierenga/EmbeddedPrimes | 0 | 4699 | <reponame>JoshuaWierenga/EmbeddedPrimes
extern malloc: PROC
extern free: PROC
.code
generate_primes PROC
; Rather than continually pushing and poping n and pSize to get around malloc overridding them since they are volatile
; some non volatile registers can be backed up and then used to house n and pSize
push r12
push r13
mov r12, rcx ; n
mov r13, rdx ; pSize
; Allocate boolean array
shr rcx, 1
sub rsp, 20h
call malloc
add rsp, 20h
mov r8, 1
booleanFillLoop:
mov rcx, r8
shr rcx, 1
mov byte ptr [rax + rcx], 1
add r8, 2
cmp r8, r12
jl booleanFillLoop
; Performs r11 = ceil(sqrt(r12)) for max factor, sqrt is done here and ceil is done implicitly using comparisons
; Assumes sse2 support, todo check first and use fpu otherwise?
; sse2 support is in x86_64 baseline though, it might be fine to assume support
cvtsi2sd xmm0, r12
sqrtsd xmm0, xmm0
cvttsd2si r11, xmm0
mov r8, 3 ; outer loop counter
mov r9, 1 ; prime count
primeCheckLoop:
; ensure prime status
; TODO: See if any performance can be gained by moving this check, 3 will always pass
mov rcx, r8
shr rcx, 1
cmp byte ptr [rax + rcx], 1
jne primeCheckLoopIterate
inc r9
; ensure r8 <= r11/max factor for performance since only going that far will give the same result
cmp r8, r11
jg primeCheckLoopIterate
; inner loop counter
mov r10, r8
shl r10, 1
add r10, r8
primeCheckLoopInner:
cmp r10, r12
jnl primeCheckLoopIterate
mov rcx, r10
shr rcx, 1
mov byte ptr [rax + rcx], 0
add r10, r8
add r10, r8
jmp primeCheckLoopInner
primeCheckLoopIterate:
add r8, 2
cmp r8, r12
jl primeCheckLoop
mov dword ptr [r13], r9d
mov r13, rax ; bool array
; Allocate integer array
shl r9, 2
mov rcx, r9
sub rsp, 20h
call malloc
add rsp, 20h
mov dword ptr [rax], 2
mov r8, 3; loop counter/bool array indexer
mov r9, 4; int array indexer
primeFillLoop:
mov rcx, r8
shr rcx, 1
cmp byte ptr [r13 + rcx], 1
jne primeFillLoopIterate
mov dword ptr [rax + r9], r8d
add r9, 4
primeFillLoopIterate:
add r8, 2
cmp r8, r12
jl primeFillLoop
mov rcx, r13
mov r13, rax
sub rsp, 20h
call free
add rsp, 20h
mov rax, r13
pop r13
pop r12
ret
generate_primes ENDP
END |
programs/oeis/303/A303281.asm | jmorken/loda | 1 | 173064 | ; A303281: Expansion of (x/(1 - x)) * (d/dx) Sum_{p prime, k>=1} x^(p^k)/(1 - x^(p^k)).
; 0,2,5,13,18,30,37,61,79,99,110,146,159,187,217,281,298,352,371,431,473,517,540,636,686,738,819,903,932,1022,1053,1213,1279,1347,1417,1561,1598,1674,1752,1912,1953,2079,2122,2254,2389,2481,2528,2768,2866,3016,3118,3274,3327,3543,3653
mov $27,$0
mov $29,$0
lpb $29
clr $0,27
mov $0,$27
sub $29,1
sub $0,$29
add $5,$0
cal $0,73093 ; Number of prime power divisors of n.
sub $0,1
mul $5,2
add $5,2
mul $0,$5
add $1,$0
mov $5,$1
mul $5,2
add $2,$5
mov $1,$2
div $1,4
add $28,$1
lpe
mov $1,$28
|
programs/oeis/164/A164611.asm | karttu/loda | 0 | 9414 | ; A164611: Expansion of (1 + x + 2*x^2 - x^3)/(1 - 2*x + 3*x^2 - 2*x^3 + x^4).
; 1,3,5,2,-6,-11,-5,9,17,8,-12,-23,-11,15,29,14,-18,-35,-17,21,41,20,-24,-47,-23,27,53,26,-30,-59,-29,33,65,32,-36,-71,-35,39,77,38,-42,-83,-41,45,89,44,-48,-95,-47,51,101,50,-54,-107,-53,57,113,56,-60,-119,-59,63,125,62,-66,-131,-65,69,137,68,-72,-143,-71,75,149,74,-78,-155,-77,81,161,80,-84,-167,-83,87,173,86,-90,-179,-89,93,185,92,-96,-191,-95,99,197,98,-102,-203,-101,105,209,104,-108,-215,-107,111,221,110,-114,-227,-113,117,233,116,-120,-239,-119,123,245,122,-126,-251,-125,129,257,128,-132,-263,-131,135,269,134,-138,-275,-137,141,281,140,-144,-287,-143,147,293,146,-150,-299,-149,153,305,152,-156,-311,-155,159,317,158,-162,-323,-161,165,329,164,-168,-335,-167,171,341,170,-174,-347,-173,177,353,176,-180,-359,-179,183,365,182,-186,-371,-185,189,377,188,-192,-383,-191,195,389,194,-198,-395,-197,201,401,200,-204,-407,-203,207,413,206,-210,-419,-209,213,425,212,-216,-431,-215,219,437,218,-222,-443,-221,225,449,224,-228,-455,-227,231,461,230,-234,-467,-233,237,473,236,-240,-479,-239,243,485,242,-246,-491,-245,249,497,248
mov $1,1
mov $2,$0
lpb $2,1
add $1,$0
sub $0,$1
sub $2,1
lpe
sub $1,$0
|
Assignment-6/wget-original.asm | droberson/SLAE | 6 | 19810 | <gh_stars>1-10
; Filename: downloadexec.nasm
; Author: <NAME>
; Website: http://govolution.wordpress.com/
; Tested on: Ubuntu 12.04 / 32Bit
; License: http://creativecommons.org/licenses/by-sa/3.0/
; Shellcode:
; - download 192.168.2.222/x with wget
; - chmod x
; - execute x
; - x is an executable
; - length 108 bytes
; % xxd wget-original
;00000000: 31c0 b002 cd80 31db 39d8 742a 31c0 b007 1.....1.9.t*1...
;00000010: cd80 31c9 31c0 50b0 0f6a 7889 e331 c966 ..1.1.P..jx..1.f
;00000020: b9ff 01cd 8031 c050 6a78 89e3 5089 e253 .....1.Pjx..P..S
;00000030: 89e1 b00b cd80 6a0b 5899 5268 322f 2f78 ......j.X.Rh2//x
;00000040: 6832 2e32 3268 3136 382e 6831 3932 2e89 h2.22h168.h192..
;00000050: e152 6a74 682f 7767 6568 2f62 696e 682f .Rjth/wgeh/binh/
;00000060: 7573 7289 e352 5153 89e1 cd80 usr..RQS....
; "\x31\xc0\xb0\x02\xcd\x80\x31\xdb\x39\xd8\x74\x2a\x31\xc0\xb0\x07"
; "\xcd\x80\x31\xc9\x31\xc0\x50\xb0\x0f\x6a\x78\x89\xe3\x31\xc9\x66"
; "\xb9\xff\x01\xcd\x80\x31\xc0\x50\x6a\x78\x89\xe3\x50\x89\xe2\x53"
; "\x89\xe1\xb0\x0b\xcd\x80\x6a\x0b\x58\x99\x52\x68\x32\x2f\x2f\x78"
; "\x68\x32\x2e\x32\x32\x68\x31\x36\x38\x2e\x68\x31\x39\x32\x2e\x89"
; "\xe1\x52\x6a\x74\x68\x2f\x77\x67\x65\x68\x2f\x62\x69\x6e\x68\x2f"
; "\x75\x73\x72\x89\xe3\x52\x51\x53\x89\xe1\xcd\x80";
BITS 32
global _start
section .text
_start:
;fork
xor eax,eax
mov al,0x2
int 0x80
xor ebx,ebx
cmp eax,ebx
jz child
;wait(NULL)
xor eax,eax
mov al,0x7
int 0x80
;chmod x
xor ecx,ecx
xor eax, eax
push eax
mov al, 0xf
push 0x78
mov ebx, esp
xor ecx, ecx
mov cx, 0x1ff
int 0x80
;exec x
xor eax, eax
push eax
push 0x78
mov ebx, esp
push eax
mov edx, esp
push ebx
mov ecx, esp
mov al, 11
int 0x80
child:
;download 192.168.2.222//x with wget
push 0xb
pop eax
cdq
push edx
push 0x782f2f32 ;2//x avoid null byte
push 0x32322e32 ;22.2
push 0x2e383631 ;.861
push 0x2e323931 ;.291
mov ecx,esp
push edx
push 0x74 ;t
push 0x6567772f ;egw/
push 0x6e69622f ;nib/
push 0x7273752f ;rsu/
mov ebx,esp
push edx
push ecx
push ebx
mov ecx,esp
int 0x80
|
Cubical/Algebra/CommAlgebra/Instances/FreeCommAlgebra.agda | lpw25/cubical | 0 | 2196 | {-# OPTIONS --safe #-}
module Cubical.Algebra.CommAlgebra.Instances.FreeCommAlgebra where
{-
The free commutative algebra over a commutative ring,
or in other words the ring of polynomials with coefficients in a given ring.
Note that this is a constructive definition, which entails that polynomials
cannot be represented by lists of coefficients, where the last one is non-zero.
For rings with decidable equality, that is still possible.
I learned about this (and other) definition(s) from <NAME>.
You can watch him talk about these things here:
https://www.youtube.com/watch?v=VNp-f_9MnVk
This file contains
* the definition of the free commutative algebra on a type I over a commutative ring R as a HIT
(let us call that R[I])
* a prove that the construction is an commutative R-algebra
* definitions of the induced maps appearing in the universal property of R[I],
that is: * for any map I → A, where A is a commutative R-algebra,
the induced algebra homomorphism R[I] → A
('inducedHom')
* for any hom R[I] → A, the 'restricttion to variables' I → A
('evaluateAt')
* a proof that the two constructions are inverse to each other
('homRetrievable' and 'mapRetrievable')
* a proof, that the corresponding pointwise equivalence of functors is natural
('naturalR', 'naturalL')
-}
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Structure
open import Cubical.Foundations.Function hiding (const)
open import Cubical.Algebra.CommRing
open import Cubical.Algebra.Ring using ()
open import Cubical.Algebra.CommAlgebra
open import Cubical.Algebra.Algebra
open import Cubical.HITs.SetTruncation
private
variable
ℓ ℓ' ℓ'' : Level
module Construction (R : CommRing ℓ) where
open CommRingStr (snd R) using (1r; 0r) renaming (_+_ to _+r_; _·_ to _·r_)
data R[_] (I : Type ℓ') : Type (ℓ-max ℓ ℓ') where
var : I → R[ I ]
const : ⟨ R ⟩ → R[ I ]
_+_ : R[ I ] → R[ I ] → R[ I ]
-_ : R[ I ] → R[ I ]
_·_ : R[ I ] → R[ I ] → R[ I ] -- \cdot
+-assoc : (x y z : R[ I ]) → x + (y + z) ≡ (x + y) + z
+-rid : (x : R[ I ]) → x + (const 0r) ≡ x
+-rinv : (x : R[ I ]) → x + (- x) ≡ (const 0r)
+-comm : (x y : R[ I ]) → x + y ≡ y + x
·-assoc : (x y z : R[ I ]) → x · (y · z) ≡ (x · y) · z
·-lid : (x : R[ I ]) → (const 1r) · x ≡ x
·-comm : (x y : R[ I ]) → x · y ≡ y · x
ldist : (x y z : R[ I ]) → (x + y) · z ≡ (x · z) + (y · z)
+HomConst : (s t : ⟨ R ⟩) → const (s +r t) ≡ const s + const t
·HomConst : (s t : ⟨ R ⟩) → const (s ·r t) ≡ (const s) · (const t)
0-trunc : (x y : R[ I ]) (p q : x ≡ y) → p ≡ q
_⋆_ : {I : Type ℓ'} → ⟨ R ⟩ → R[ I ] → R[ I ]
r ⋆ x = const r · x
⋆-assoc : {I : Type ℓ'} → (s t : ⟨ R ⟩) (x : R[ I ]) → (s ·r t) ⋆ x ≡ s ⋆ (t ⋆ x)
⋆-assoc s t x = const (s ·r t) · x ≡⟨ cong (λ u → u · x) (·HomConst _ _) ⟩
(const s · const t) · x ≡⟨ sym (·-assoc _ _ _) ⟩
const s · (const t · x) ≡⟨ refl ⟩
s ⋆ (t ⋆ x) ∎
⋆-ldist-+ : {I : Type ℓ'} → (s t : ⟨ R ⟩) (x : R[ I ]) → (s +r t) ⋆ x ≡ (s ⋆ x) + (t ⋆ x)
⋆-ldist-+ s t x = (s +r t) ⋆ x ≡⟨ cong (λ u → u · x) (+HomConst _ _) ⟩
(const s + const t) · x ≡⟨ ldist _ _ _ ⟩
(s ⋆ x) + (t ⋆ x) ∎
⋆-rdist-+ : {I : Type ℓ'} → (s : ⟨ R ⟩) (x y : R[ I ]) → s ⋆ (x + y) ≡ (s ⋆ x) + (s ⋆ y)
⋆-rdist-+ s x y = const s · (x + y) ≡⟨ ·-comm _ _ ⟩
(x + y) · const s ≡⟨ ldist _ _ _ ⟩
(x · const s) + (y · const s) ≡⟨ cong (λ u → u + (y · const s)) (·-comm _ _) ⟩
(s ⋆ x) + (y · const s) ≡⟨ cong (λ u → (s ⋆ x) + u) (·-comm _ _) ⟩
(s ⋆ x) + (s ⋆ y) ∎
⋆-assoc-· : {I : Type ℓ'} → (s : ⟨ R ⟩) (x y : R[ I ]) → (s ⋆ x) · y ≡ s ⋆ (x · y)
⋆-assoc-· s x y = (s ⋆ x) · y ≡⟨ sym (·-assoc _ _ _) ⟩
s ⋆ (x · y) ∎
0a : {I : Type ℓ'} → R[ I ]
0a = (const 0r)
1a : {I : Type ℓ'} → R[ I ]
1a = (const 1r)
isCommAlgebra : {I : Type ℓ'} → IsCommAlgebra R {A = R[ I ]} 0a 1a _+_ _·_ -_ _⋆_
isCommAlgebra = makeIsCommAlgebra 0-trunc
+-assoc +-rid +-rinv +-comm
·-assoc ·-lid ldist ·-comm
⋆-assoc ⋆-ldist-+ ⋆-rdist-+ ·-lid ⋆-assoc-·
_[_] : (R : CommRing ℓ) (I : Type ℓ') → CommAlgebra R (ℓ-max ℓ ℓ')
(R [ I ]) = R[ I ] , commalgebrastr 0a 1a _+_ _·_ -_ _⋆_ isCommAlgebra
where
open Construction R
module Theory {R : CommRing ℓ} {I : Type ℓ'} where
open CommRingStr (snd R)
using (0r; 1r)
renaming (_·_ to _·r_; _+_ to _+r_; ·Comm to ·r-comm; ·Rid to ·r-rid)
module _ (A : CommAlgebra R ℓ'') (φ : I → ⟨ A ⟩) where
open CommAlgebraStr (A .snd)
open AlgebraTheory (CommRing→Ring R) (CommAlgebra→Algebra A)
open Construction using (var; const) renaming (_+_ to _+c_; -_ to -c_; _·_ to _·c_)
imageOf0Works : 0r ⋆ 1a ≡ 0a
imageOf0Works = 0-actsNullifying 1a
imageOf1Works : 1r ⋆ 1a ≡ 1a
imageOf1Works = ⋆-lid 1a
inducedMap : ⟨ R [ I ] ⟩ → ⟨ A ⟩
inducedMap (var x) = φ x
inducedMap (const r) = r ⋆ 1a
inducedMap (P +c Q) = (inducedMap P) + (inducedMap Q)
inducedMap (-c P) = - inducedMap P
inducedMap (Construction.+-assoc P Q S i) = +-assoc (inducedMap P) (inducedMap Q) (inducedMap S) i
inducedMap (Construction.+-rid P i) =
let
eq : (inducedMap P) + (inducedMap (const 0r)) ≡ (inducedMap P)
eq = (inducedMap P) + (inducedMap (const 0r)) ≡⟨ refl ⟩
(inducedMap P) + (0r ⋆ 1a) ≡⟨ cong
(λ u → (inducedMap P) + u)
(imageOf0Works) ⟩
(inducedMap P) + 0a ≡⟨ +-rid _ ⟩
(inducedMap P) ∎
in eq i
inducedMap (Construction.+-rinv P i) =
let eq : (inducedMap P - inducedMap P) ≡ (inducedMap (const 0r))
eq = (inducedMap P - inducedMap P) ≡⟨ +-rinv _ ⟩
0a ≡⟨ sym imageOf0Works ⟩
(inducedMap (const 0r))∎
in eq i
inducedMap (Construction.+-comm P Q i) = +-comm (inducedMap P) (inducedMap Q) i
inducedMap (P ·c Q) = inducedMap P · inducedMap Q
inducedMap (Construction.·-assoc P Q S i) = ·Assoc (inducedMap P) (inducedMap Q) (inducedMap S) i
inducedMap (Construction.·-lid P i) =
let eq = inducedMap (const 1r) · inducedMap P ≡⟨ cong (λ u → u · inducedMap P) imageOf1Works ⟩
1a · inducedMap P ≡⟨ ·Lid (inducedMap P) ⟩
inducedMap P ∎
in eq i
inducedMap (Construction.·-comm P Q i) = ·-comm (inducedMap P) (inducedMap Q) i
inducedMap (Construction.ldist P Q S i) = ·Ldist+ (inducedMap P) (inducedMap Q) (inducedMap S) i
inducedMap (Construction.+HomConst s t i) = ⋆-ldist s t 1a i
inducedMap (Construction.·HomConst s t i) =
let eq = (s ·r t) ⋆ 1a ≡⟨ cong (λ u → u ⋆ 1a) (·r-comm _ _) ⟩
(t ·r s) ⋆ 1a ≡⟨ ⋆-assoc t s 1a ⟩
t ⋆ (s ⋆ 1a) ≡⟨ cong (λ u → t ⋆ u) (sym (·Rid _)) ⟩
t ⋆ ((s ⋆ 1a) · 1a) ≡⟨ ⋆-rassoc t (s ⋆ 1a) 1a ⟩
(s ⋆ 1a) · (t ⋆ 1a) ∎
in eq i
inducedMap (Construction.0-trunc P Q p q i j) =
isSetAlgebra (CommAlgebra→Algebra A) (inducedMap P) (inducedMap Q) (cong _ p) (cong _ q) i j
module _ where
open IsAlgebraHom
inducedHom : AlgebraHom (CommAlgebra→Algebra (R [ I ])) (CommAlgebra→Algebra A)
inducedHom .fst = inducedMap
inducedHom .snd .pres0 = 0-actsNullifying _
inducedHom .snd .pres1 = imageOf1Works
inducedHom .snd .pres+ x y = refl
inducedHom .snd .pres· x y = refl
inducedHom .snd .pres- x = refl
inducedHom .snd .pres⋆ r x =
(r ⋆ 1a) · inducedMap x ≡⟨ ⋆-lassoc r 1a (inducedMap x) ⟩
r ⋆ (1a · inducedMap x) ≡⟨ cong (λ u → r ⋆ u) (·Lid (inducedMap x)) ⟩
r ⋆ inducedMap x ∎
module _ (A : CommAlgebra R ℓ'') where
open CommAlgebraStr (A .snd)
open AlgebraTheory (CommRing→Ring R) (CommAlgebra→Algebra A)
open Construction using (var; const) renaming (_+_ to _+c_; -_ to -c_; _·_ to _·c_)
Hom = AlgebraHom (CommAlgebra→Algebra (R [ I ])) (CommAlgebra→Algebra A)
open IsAlgebraHom
evaluateAt : Hom → I → ⟨ A ⟩
evaluateAt φ x = φ .fst (var x)
mapRetrievable : ∀ (φ : I → ⟨ A ⟩)
→ evaluateAt (inducedHom A φ) ≡ φ
mapRetrievable φ = refl
proveEq : ∀ {X : Type ℓ''} (isSetX : isSet X) (f g : ⟨ R [ I ] ⟩ → X)
→ (var-eq : (x : I) → f (var x) ≡ g (var x))
→ (const-eq : (r : ⟨ R ⟩) → f (const r) ≡ g (const r))
→ (+-eq : (x y : ⟨ R [ I ] ⟩) → (eq-x : f x ≡ g x) → (eq-y : f y ≡ g y)
→ f (x +c y) ≡ g (x +c y))
→ (·-eq : (x y : ⟨ R [ I ] ⟩) → (eq-x : f x ≡ g x) → (eq-y : f y ≡ g y)
→ f (x ·c y) ≡ g (x ·c y))
→ (-eq : (x : ⟨ R [ I ] ⟩) → (eq-x : f x ≡ g x)
→ f (-c x) ≡ g (-c x))
→ f ≡ g
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (var x) = var-eq x i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (const x) = const-eq x i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (x +c y) =
+-eq x y
(λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
(λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i y)
i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (-c x) =
-eq x ((λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)) i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (x ·c y) =
·-eq x y
(λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
(λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i y)
i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.+-assoc x y z j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f (x +c (y +c z)) ≡ g (x +c (y +c z))
a₀₋ = +-eq _ _ (rec x) (+-eq _ _ (rec y) (rec z))
a₁₋ : f ((x +c y) +c z) ≡ g ((x +c y) +c z)
a₁₋ = +-eq _ _ (+-eq _ _ (rec x) (rec y)) (rec z)
a₋₀ : f (x +c (y +c z)) ≡ f ((x +c y) +c z)
a₋₀ = cong f (Construction.+-assoc x y z)
a₋₁ : g (x +c (y +c z)) ≡ g ((x +c y) +c z)
a₋₁ = cong g (Construction.+-assoc x y z)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.+-rid x j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f (x +c (const 0r)) ≡ g (x +c (const 0r))
a₀₋ = +-eq _ _ (rec x) (const-eq 0r)
a₁₋ : f x ≡ g x
a₁₋ = rec x
a₋₀ : f (x +c (const 0r)) ≡ f x
a₋₀ = cong f (Construction.+-rid x)
a₋₁ : g (x +c (const 0r)) ≡ g x
a₋₁ = cong g (Construction.+-rid x)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.+-rinv x j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f (x +c (-c x)) ≡ g (x +c (-c x))
a₀₋ = +-eq x (-c x) (rec x) (-eq x (rec x))
a₁₋ : f (const 0r) ≡ g (const 0r)
a₁₋ = const-eq 0r
a₋₀ : f (x +c (-c x)) ≡ f (const 0r)
a₋₀ = cong f (Construction.+-rinv x)
a₋₁ : g (x +c (-c x)) ≡ g (const 0r)
a₋₁ = cong g (Construction.+-rinv x)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.+-comm x y j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f (x +c y) ≡ g (x +c y)
a₀₋ = +-eq x y (rec x) (rec y)
a₁₋ : f (y +c x) ≡ g (y +c x)
a₁₋ = +-eq y x (rec y) (rec x)
a₋₀ : f (x +c y) ≡ f (y +c x)
a₋₀ = cong f (Construction.+-comm x y)
a₋₁ : g (x +c y) ≡ g (y +c x)
a₋₁ = cong g (Construction.+-comm x y)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.·-assoc x y z j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f (x ·c (y ·c z)) ≡ g (x ·c (y ·c z))
a₀₋ = ·-eq _ _ (rec x) (·-eq _ _ (rec y) (rec z))
a₁₋ : f ((x ·c y) ·c z) ≡ g ((x ·c y) ·c z)
a₁₋ = ·-eq _ _ (·-eq _ _ (rec x) (rec y)) (rec z)
a₋₀ : f (x ·c (y ·c z)) ≡ f ((x ·c y) ·c z)
a₋₀ = cong f (Construction.·-assoc x y z)
a₋₁ : g (x ·c (y ·c z)) ≡ g ((x ·c y) ·c z)
a₋₁ = cong g (Construction.·-assoc x y z)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.·-lid x j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f ((const 1r) ·c x) ≡ g ((const 1r) ·c x)
a₀₋ = ·-eq _ _ (const-eq 1r) (rec x)
a₁₋ : f x ≡ g x
a₁₋ = rec x
a₋₀ : f ((const 1r) ·c x) ≡ f x
a₋₀ = cong f (Construction.·-lid x)
a₋₁ : g ((const 1r) ·c x) ≡ g x
a₋₁ = cong g (Construction.·-lid x)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.·-comm x y j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f (x ·c y) ≡ g (x ·c y)
a₀₋ = ·-eq _ _ (rec x) (rec y)
a₁₋ : f (y ·c x) ≡ g (y ·c x)
a₁₋ = ·-eq _ _ (rec y) (rec x)
a₋₀ : f (x ·c y) ≡ f (y ·c x)
a₋₀ = cong f (Construction.·-comm x y)
a₋₁ : g (x ·c y) ≡ g (y ·c x)
a₋₁ = cong g (Construction.·-comm x y)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.ldist x y z j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f ((x +c y) ·c z) ≡ g ((x +c y) ·c z)
a₀₋ = ·-eq (x +c y) z
(+-eq _ _ (rec x) (rec y))
(rec z)
a₁₋ : f ((x ·c z) +c (y ·c z)) ≡ g ((x ·c z) +c (y ·c z))
a₁₋ = +-eq _ _ (·-eq _ _ (rec x) (rec z)) (·-eq _ _ (rec y) (rec z))
a₋₀ : f ((x +c y) ·c z) ≡ f ((x ·c z) +c (y ·c z))
a₋₀ = cong f (Construction.ldist x y z)
a₋₁ : g ((x +c y) ·c z) ≡ g ((x ·c z) +c (y ·c z))
a₋₁ = cong g (Construction.ldist x y z)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.+HomConst s t j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f (const (s +r t)) ≡ g (const (s +r t))
a₀₋ = const-eq (s +r t)
a₁₋ : f (const s +c const t) ≡ g (const s +c const t)
a₁₋ = +-eq _ _ (const-eq s) (const-eq t)
a₋₀ : f (const (s +r t)) ≡ f (const s +c const t)
a₋₀ = cong f (Construction.+HomConst s t)
a₋₁ : g (const (s +r t)) ≡ g (const s +c const t)
a₋₁ = cong g (Construction.+HomConst s t)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.·HomConst s t j) =
let
rec : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
rec x = (λ i → proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x)
a₀₋ : f (const (s ·r t)) ≡ g (const (s ·r t))
a₀₋ = const-eq (s ·r t)
a₁₋ : f (const s ·c const t) ≡ g (const s ·c const t)
a₁₋ = ·-eq _ _ (const-eq s) (const-eq t)
a₋₀ : f (const (s ·r t)) ≡ f (const s ·c const t)
a₋₀ = cong f (Construction.·HomConst s t)
a₋₁ : g (const (s ·r t)) ≡ g (const s ·c const t)
a₋₁ = cong g (Construction.·HomConst s t)
in isSet→isSet' isSetX a₀₋ a₁₋ a₋₀ a₋₁ j i
proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i (Construction.0-trunc x y p q j k) =
let
P : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
P x i = proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x
Q : (x : ⟨ R [ I ] ⟩) → f x ≡ g x
Q x i = proveEq isSetX f g var-eq const-eq +-eq ·-eq -eq i x
in isOfHLevel→isOfHLevelDep 2
(λ z → isProp→isSet (isSetX (f z) (g z))) _ _
(cong P p)
(cong Q q)
(Construction.0-trunc x y p q) j k i
homRetrievable : ∀ (f : Hom)
→ inducedMap A (evaluateAt f) ≡ fst f
homRetrievable f =
proveEq
(isSetAlgebra (CommAlgebra→Algebra A))
(inducedMap A (evaluateAt f))
(λ x → f $a x)
(λ x → refl)
(λ r → r ⋆ 1a ≡⟨ cong (λ u → r ⋆ u) (sym f.pres1) ⟩
r ⋆ (f $a (const 1r)) ≡⟨ sym (f.pres⋆ r _) ⟩
f $a (const r ·c const 1r) ≡⟨ cong (λ u → f $a u) (sym (Construction.·HomConst r 1r)) ⟩
f $a (const (r ·r 1r)) ≡⟨ cong (λ u → f $a (const u)) (·r-rid r) ⟩
f $a (const r) ∎)
(λ x y eq-x eq-y →
ι (x +c y) ≡⟨ refl ⟩
(ι x + ι y) ≡⟨ cong (λ u → u + ι y) eq-x ⟩
((f $a x) + ι y) ≡⟨
cong (λ u → (f $a x) + u) eq-y ⟩
((f $a x) + (f $a y)) ≡⟨ sym (f.pres+ _ _) ⟩ (f $a (x +c y)) ∎)
(λ x y eq-x eq-y →
ι (x ·c y) ≡⟨ refl ⟩
ι x · ι y ≡⟨ cong (λ u → u · ι y) eq-x ⟩
(f $a x) · (ι y) ≡⟨ cong (λ u → (f $a x) · u) eq-y ⟩
(f $a x) · (f $a y) ≡⟨ sym (f.pres· _ _) ⟩
f $a (x ·c y) ∎)
(λ x eq-x →
ι (-c x) ≡⟨ refl ⟩
- ι x ≡⟨ cong (λ u → - u) eq-x ⟩
- (f $a x) ≡⟨ sym (f.pres- x) ⟩
f $a (-c x) ∎)
where
ι = inducedMap A (evaluateAt f)
module f = IsAlgebraHom (f .snd)
evaluateAt : {R : CommRing ℓ} {I : Type ℓ'} (A : CommAlgebra R ℓ'')
(f : AlgebraHom (CommAlgebra→Algebra (R [ I ])) (CommAlgebra→Algebra A))
→ (I → ⟨ A ⟩)
evaluateAt A f x = f $a (Construction.var x)
inducedHom : {R : CommRing ℓ} {I : Type ℓ'} (A : CommAlgebra R ℓ'')
(φ : I → ⟨ A ⟩)
→ AlgebraHom (CommAlgebra→Algebra (R [ I ])) (CommAlgebra→Algebra A)
inducedHom A φ = Theory.inducedHom A φ
module _ {R : CommRing ℓ} {A B : CommAlgebra R ℓ''} where
A′ = CommAlgebra→Algebra A
B′ = CommAlgebra→Algebra B
R′ = (CommRing→Ring R)
ν : AlgebraHom A′ B′ → (⟨ A ⟩ → ⟨ B ⟩)
ν φ = φ .fst
{-
Hom(R[I],A) → (I → A)
↓ ↓
Hom(R[I],B) → (I → B)
-}
naturalR : {I : Type ℓ'} (ψ : AlgebraHom A′ B′)
(f : AlgebraHom (CommAlgebra→Algebra (R [ I ])) A′)
→ (ν ψ) ∘ evaluateAt A f ≡ evaluateAt B (ψ ∘a f)
naturalR ψ f = refl
{-
Hom(R[I],A) → (I → A)
↓ ↓
Hom(R[J],A) → (J → A)
-}
naturalL : {I J : Type ℓ'} (φ : J → I)
(f : AlgebraHom (CommAlgebra→Algebra (R [ I ])) A′)
→ (evaluateAt A f) ∘ φ
≡ evaluateAt A (f ∘a (inducedHom (R [ I ]) (λ x → Construction.var (φ x))))
naturalL φ f = refl
|
hax_to_desimal.asm | tz01x/8086_emu.ind | 0 | 101066 | <gh_stars>0
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
;hax to desimal
mov ax,900h
mov ds,ax
mov si,10
mov di,15
mov [2],'1'
mov [4],'2'
mov [6],'3'
mov [8],'4'
mov [10],'5'
mov [12],'6'
mov [14],'7'
mov [16],'8'
mov [18],'9'
mov [20],'10'
mov [22],'11'
mov [24],'12'
mov [26],'13'
mov [28],'14'
mov [30],'15'
mov ah,2
mov bl,0Ah ;hex vlue here
anotherDigit:
mov si,0
mov cx,0
rep_inner:
shl si,1 ;left shift
test bl,10000000b ; checking if the first bit is zerro or not
;if first bit bf bl is 1 then zflag is 0
jz cu
add si,1b
cu:
shl bl,1 ; left shif
inc cx ;increment counter to check if we iter 4bit
cmp cx,4
jl rep_inner
shl si,1 ; left shift to [ si=si*2]
cmp si,20
jge a
jmp lastBitChecker
a:
mov dl,[si][1]
int 21h;
lastBitChecker:
mov dl,[si]
int 21h
test bl,bl
jnz anotherDigit
hlt
ret
|
Jira2Notes/start.applescript | keremkoseoglu/Python-Library | 3 | 896 | tell application "Google Chrome"
set x to (URL of active tab of first window as text)
end tell
do shell script "/Users/kerem/Dropbox/Software/Kerem/Development/Python\\ Library/Jira2Notes/venv/bin/python /Users/kerem/Dropbox/Software/Kerem/Development/Python\\ Library/Jira2Notes/j2n.py " & x |
Transynther/x86/_processed/NONE/_un_xt_sm_/i9-9900K_12_0xca.log_21829_1674.asm | ljhsiun2/medusa | 9 | 85423 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xc7d, %rbx
nop
nop
nop
cmp $33585, %r12
movups (%rbx), %xmm3
vpextrq $0, %xmm3, %rdi
nop
nop
nop
nop
nop
cmp $62985, %r15
lea addresses_WC_ht+0x178fd, %r12
nop
nop
nop
nop
nop
and $30849, %r9
movw $0x6162, (%r12)
nop
nop
cmp %rdi, %rdi
lea addresses_UC_ht+0x547d, %rbx
nop
nop
nop
cmp $8217, %r8
mov (%rbx), %rdi
nop
inc %r15
lea addresses_WC_ht+0x1e10d, %rsi
lea addresses_A_ht+0x17c7d, %rdi
nop
nop
nop
inc %r12
mov $12, %rcx
rep movsb
sub $30170, %r8
lea addresses_WC_ht+0x52fd, %r8
xor %r15, %r15
mov $0x6162636465666768, %rbx
movq %rbx, (%r8)
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WT_ht+0x1410d, %r8
nop
nop
sub $1529, %r12
vmovups (%r8), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %r9
nop
nop
nop
nop
xor $21924, %r12
lea addresses_normal_ht+0x1b77d, %rsi
lea addresses_normal_ht+0x1d93d, %rdi
nop
nop
nop
nop
cmp %r8, %r8
mov $125, %rcx
rep movsq
inc %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r8
push %r9
push %rbp
push %rdx
// Store
lea addresses_normal+0x1c17d, %r12
nop
nop
nop
nop
nop
and %r10, %r10
mov $0x5152535455565758, %rbp
movq %rbp, %xmm1
vmovups %ymm1, (%r12)
nop
nop
cmp $32504, %r13
// Store
lea addresses_UC+0x1847d, %r9
nop
xor %r8, %r8
movb $0x51, (%r9)
and $52982, %r12
// Faulty Load
lea addresses_UC+0x1847d, %r8
nop
nop
nop
nop
nop
add $43802, %rbp
mov (%r8), %r9d
lea oracles, %r8
and $0xff, %r9
shlq $12, %r9
mov (%r8,%r9,1), %r9
pop %rdx
pop %rbp
pop %r9
pop %r8
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_UC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}}
{'a0': 3, '51': 21826}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
|
tests/bases-cargo-test_data-tests.adb | thindil/steamsky | 80 | 25040 | -- This package has been generated automatically by GNATtest.
-- You are allowed to add your code to the bodies of test routines.
-- Such changes will be kept during further regeneration of this file.
-- All code placed outside of test routine bodies will be lost. The
-- code intended to set up and tear down the test environment should be
-- placed into Bases.Cargo.Test_Data.
with AUnit.Assertions; use AUnit.Assertions;
with System.Assertions;
-- begin read only
-- id:2.2/00/
--
-- This section can be used to add with clauses if necessary.
--
-- end read only
with Maps; use Maps;
-- begin read only
-- end read only
package body Bases.Cargo.Test_Data.Tests is
-- begin read only
-- id:2.2/01/
--
-- This section can be used to add global variables and other elements.
--
-- end read only
-- begin read only
-- end read only
-- begin read only
procedure Wrap_Test_Generate_Cargo_bedd31_021eea is
begin
GNATtest_Generated.GNATtest_Standard.Bases.Cargo.Generate_Cargo;
end Wrap_Test_Generate_Cargo_bedd31_021eea;
-- end read only
-- begin read only
procedure Test_Generate_Cargo_test_generatecargo(Gnattest_T: in out Test);
procedure Test_Generate_Cargo_bedd31_021eea(Gnattest_T: in out Test) renames
Test_Generate_Cargo_test_generatecargo;
-- id:2.2/bedd31198f3fb6a9/Generate_Cargo/1/0/test_generatecargo/
procedure Test_Generate_Cargo_test_generatecargo(Gnattest_T: in out Test) is
procedure Generate_Cargo renames Wrap_Test_Generate_Cargo_bedd31_021eea;
-- end read only
pragma Unreferenced(Gnattest_T);
BaseIndex: constant Positive :=
SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex;
begin
Sky_Bases(BaseIndex).Cargo.Clear;
Generate_Cargo;
Assert
(Sky_Bases(BaseIndex).Cargo.Length > 0,
"Failed to generate base cargo.");
-- begin read only
end Test_Generate_Cargo_test_generatecargo;
-- end read only
-- begin read only
procedure Wrap_Test_Update_Base_Cargo_0621ee_1e1787
(Proto_Index: Unbounded_String := Null_Unbounded_String; Amount: Integer;
Durability: Items_Durability := Default_Item_Durability;
Cargo_Index: Inventory_Container.Extended_Index := 0) is
begin
GNATtest_Generated.GNATtest_Standard.Bases.Cargo.Update_Base_Cargo
(Proto_Index, Amount, Durability, Cargo_Index);
end Wrap_Test_Update_Base_Cargo_0621ee_1e1787;
-- end read only
-- begin read only
procedure Test_Update_Base_Cargo_test_updatebasecargo
(Gnattest_T: in out Test);
procedure Test_Update_Base_Cargo_0621ee_1e1787
(Gnattest_T: in out Test) renames
Test_Update_Base_Cargo_test_updatebasecargo;
-- id:2.2/0621ee06e474ba4b/Update_Base_Cargo/1/0/test_updatebasecargo/
procedure Test_Update_Base_Cargo_test_updatebasecargo
(Gnattest_T: in out Test) is
procedure Update_Base_Cargo
(Proto_Index: Unbounded_String := Null_Unbounded_String;
Amount: Integer;
Durability: Items_Durability := Default_Item_Durability;
Cargo_Index: Inventory_Container.Extended_Index := 0) renames
Wrap_Test_Update_Base_Cargo_0621ee_1e1787;
-- end read only
pragma Unreferenced(Gnattest_T);
BaseIndex: constant Positive :=
SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex;
Amount: Positive;
ProtoIndex: Unbounded_String;
begin
Sky_Bases(BaseIndex).Cargo.Clear;
Generate_Cargo;
Amount := Sky_Bases(BaseIndex).Cargo(1).Amount - 1;
ProtoIndex := Sky_Bases(BaseIndex).Cargo(1).Proto_Index;
Update_Base_Cargo(ProtoIndex, -1);
Assert
(Sky_Bases(BaseIndex).Cargo(1).Amount = Amount,
"Failed to update base cargo with proto index.");
Update_Base_Cargo(Cargo_Index => 1, Amount => -1);
Assert
(Sky_Bases(BaseIndex).Cargo(1).Amount = Amount - 1,
"Failed to update base cargo with cargo index.");
-- begin read only
end Test_Update_Base_Cargo_test_updatebasecargo;
-- end read only
-- begin read only
function Wrap_Test_Find_Base_Cargo_7b1190_f9e132
(Proto_Index: Unbounded_String;
Durability: Items_Durability := Items_Durability'Last) return Natural is
begin
begin
pragma Assert(Length(Source => Proto_Index) > 0);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(bases-cargo.ads:0):Test_FindBaseCargo test requirement violated");
end;
declare
Test_Find_Base_Cargo_7b1190_f9e132_Result: constant Natural :=
GNATtest_Generated.GNATtest_Standard.Bases.Cargo.Find_Base_Cargo
(Proto_Index, Durability);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(bases-cargo.ads:0:):Test_FindBaseCargo test commitment violated");
end;
return Test_Find_Base_Cargo_7b1190_f9e132_Result;
end;
end Wrap_Test_Find_Base_Cargo_7b1190_f9e132;
-- end read only
-- begin read only
procedure Test_Find_Base_Cargo_test_findbasecargo(Gnattest_T: in out Test);
procedure Test_Find_Base_Cargo_7b1190_f9e132
(Gnattest_T: in out Test) renames
Test_Find_Base_Cargo_test_findbasecargo;
-- id:2.2/7b1190f4d879a165/Find_Base_Cargo/1/0/test_findbasecargo/
procedure Test_Find_Base_Cargo_test_findbasecargo
(Gnattest_T: in out Test) is
function Find_Base_Cargo
(Proto_Index: Unbounded_String;
Durability: Items_Durability := Items_Durability'Last)
return Natural renames
Wrap_Test_Find_Base_Cargo_7b1190_f9e132;
-- end read only
pragma Unreferenced(Gnattest_T);
BaseIndex: constant Positive :=
SkyMap(Player_Ship.Sky_X, Player_Ship.Sky_Y).BaseIndex;
begin
Sky_Bases(BaseIndex).Cargo.Clear;
Generate_Cargo;
Assert
(Find_Base_Cargo(To_Unbounded_String("1")) = 1,
"Failed to find charcoal.");
Assert
(Find_Base_Cargo(To_Unbounded_String("40")) = 0,
"Found item which is not in cargo.");
Assert
(Find_Base_Cargo(To_Unbounded_String("sdfsdf")) = 0,
"Found item which not exists.");
-- begin read only
end Test_Find_Base_Cargo_test_findbasecargo;
-- end read only
-- begin read only
-- id:2.2/02/
--
-- This section can be used to add elaboration code for the global state.
--
begin
-- end read only
null;
-- begin read only
-- end read only
end Bases.Cargo.Test_Data.Tests;
|
neo430/neo430-master/sw/common/crt0.asm | odrisci/LimeNET-Micro_GW | 48 | 13903 | <gh_stars>10-100
; #################################################################################################
; # < crt0.asm - general neo430 application start-up code > #
; # ********************************************************************************************* #
; # This file is part of the NEO430 Processor project: https://github.com/stnolting/neo430 #
; # Copyright by <NAME>: <EMAIL> #
; # #
; # This source file may be used and distributed without restriction provided that this copyright #
; # statement is not removed from the file and that any derivative work contains the original #
; # copyright notice and the associated disclaimer. #
; # #
; # This source file is free software; you can redistribute it and/or modify it under the terms #
; # of the GNU Lesser General Public License as published by the Free Software Foundation, #
; # either version 3 of the License, or (at your option) any later version. #
; # #
; # This source is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; #
; # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #
; # See the GNU Lesser General Public License for more details. #
; # #
; # You should have received a copy of the GNU Lesser General Public License along with this #
; # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
; # ********************************************************************************************* #
; # <NAME>, Hannover, Germany 27.12.2017 #
; #################################################################################################
.file "crt0.asm"
.section .text
.p2align 1,0
__crt0_begin:
; -----------------------------------------------------------
; Get required system info
; -----------------------------------------------------------
mov &0xFFE8, r8 ; = DMEM (RAM) base address
mov &0xFFEA, r1 ; = DMEM (RAM) size in byte
; -----------------------------------------------------------
; Minimal required hardware setup
; -----------------------------------------------------------
mov #0, r2 ; clear status register & disable interrupts
add r8, r1 ; r1 = stack pointer = end of RAM
mov #0x4700, &0xFFB8 ; deactivate watchdog
; -----------------------------------------------------------
; Initialize all IO device registers (set to zero)
; -----------------------------------------------------------
; This loop does not trigger any operations as the CTRL registers, which are located
; at offset 0 of the according device, are set to zero resulting in disabling the
; specific device.
mov #0xFF80, r9 ; beginning of IO section
__crt0_clr_io:
tst r9 ; until the end -> wrap-arounf to 0
jeq __crt0_clr_io_end
mov #0, 0(r9) ; clear entry
incd r9
jmp __crt0_clr_io
__crt0_clr_io_end:
; -----------------------------------------------------------
; Clear complete DMEM (including .bss section)
; -----------------------------------------------------------
__crt0_clr_dmem:
cmp r8, r1 ; base address equal to end of RAM?
jeq __crt0_clr_dmem_end
mov #0, 0(r8) ; clear entry
incd r8
jmp __crt0_clr_dmem
__crt0_clr_dmem_end:
; -----------------------------------------------------------
; Copy initialized .data section from ROM to RAM
; -----------------------------------------------------------
mov #__data_start_rom, r5
mov #__data_end_rom, r6
mov #__data_start, r7
__crt0_cpy_data:
cmp r5, r6
jeq __crt0_cpy_data_end
mov @r5+, 0(r7)
incd r7
jmp __crt0_cpy_data
__crt0_cpy_data_end:
; -----------------------------------------------------------
; Re-init SR and clear all pending IRQs from buffer
; -----------------------------------------------------------
mov #(1<<14), r2 ; this flag auto clears
; -----------------------------------------------------------
; Initialize all remaining registers
; -----------------------------------------------------------
mov #0, r4
; mov #0, r5 ; -- is already initialized
; mov #0, r6 ; -- is already initialized
; mov #0, r7 ; -- is already initialized
; mov #0, r8 ; -- is already initialized
; mov #0, r9 ; -- is already initialized
mov #0, r10
mov #0, r11
mov #0, r12 ; set argc = 0
mov #0, r13
mov #0, r14
mov #0, r15
; -----------------------------------------------------------
; This is where the actual application is started
; -----------------------------------------------------------
__crt0_start_main:
call #main
; -----------------------------------------------------------
; Go to endless sleep mode if main returns
; -----------------------------------------------------------
__crt0_this_is_the_end:
mov #0, r2 ; deactivate IRQs
mov #0x4700, &0xFFB8 ; deactivate watchdog
mov #(1<<4), r2 ; set CPU to sleep mode
nop
.Lfe0:
.size __crt0_begin, .Lfe0-__crt0_begin
|
programs/oeis/132/A132141.asm | jmorken/loda | 1 | 85781 | ; A132141: Numbers whose ternary representation begins with 1.
; 1,3,4,5,9,10,11,12,13,14,15,16,17,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371
mov $1,1
mov $2,$0
lpb $2
add $0,1
add $0,$1
mov $1,$0
sub $0,$2
sub $2,$0
trn $2,1
lpe
|
oeis/117/A117961.asm | neoneye/loda-programs | 11 | 27135 | <reponame>neoneye/loda-programs
; A117961: Hexagonal numbers with prime indices.
; Submitted by <NAME>
; 6,15,45,91,231,325,561,703,1035,1653,1891,2701,3321,3655,4371,5565,6903,7381,8911,10011,10585,12403,13695,15753,18721,20301,21115,22791,23653,25425,32131,34191,37401,38503,44253,45451,49141,52975,55611
seq $0,40 ; The prime numbers.
mov $1,$0
sub $0,1
add $0,$1
mul $1,$0
mov $0,$1
|
util/thg/chekb.asm | olifink/smsqe | 0 | 168197 | ; Set Check Byte V0.00 1989 <NAME> QJUMP
section thing
xdef th_chekb
xref cv_lctab
;+++
; Set the CHECK byte to standard value
;
; d0 r check byte value
; a0 c p pointer to name
; status return arbitrary
;---
th_chekb
tcb.reg reg d1/d2/a0/a2
movem.l tcb.reg,-(sp)
lea cv_lctab,a2 ; lowercase table
moveq #0,d0 ; initialise check byte
moveq #0,d1 ; and char register
move.w (a0)+,d2 ; number of chars
bra.s tcb_eloop
tcb_loop
move.b (a0)+,d1 ; next char
add.b (a2,d1.w),d0 ; lowercased
ror.b #1,d0 ; and rotated
tcb_eloop
dbra d2,tcb_loop ; next byte
movem.l (sp)+,tcb.reg
rts
end
|
oeis/306/A306198.asm | neoneye/loda-programs | 11 | 23558 | <filename>oeis/306/A306198.asm<gh_stars>10-100
; A306198: Multiplicative with a(p^e) = p^(e-1)*(p^2 - p - 1).
; Submitted by <NAME>
; 1,1,5,2,19,5,41,4,15,19,109,10,155,41,95,8,271,15,341,38,205,109,505,20,95,155,45,82,811,95,929,16,545,271,779,30,1331,341,775,76,1639,205,1805,218,285,505,2161,40,287,95,1355,310,2755,45,2071,164,1705,811,3421,190,3659,929,615,32,2945,545,4421,542,2525,779,4969,60,5255,1331,475,682,4469,775,6161,152,135,1639,6805,410,5149,1805,4055,436,7831,285,6355,1010,4645,2161,6479,80,9311,287,1635,190
add $0,1
mov $1,1
lpb $0
div $2,$1
mov $3,$0
lpb $3
mov $4,$0
mov $6,$2
cmp $6,0
add $2,$6
mod $4,$2
cmp $4,0
cmp $4,0
mov $5,$2
add $2,1
cmp $5,1
max $4,$5
sub $3,$4
lpe
mov $5,1
lpb $0
dif $0,$2
mul $5,$2
lpe
dif $5,$2
mul $1,$5
bin $2,2
sub $2,$4
mul $2,2
add $2,1
mul $1,$2
lpe
mov $0,$1
|
focus_window.scpt | rkoval/alfred-project-switcher | 1 | 2344 | #!/usr/bin/osascript
on run argv
set project to item 1 of argv
tell application "System Events"
tell application process "MacVim"
perform action "AXRaise" of (first window whose name is project)
do shell script "open -a MacVim"
end tell
end tell
end run
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/unchecked_convert7.adb | best08618/asylo | 7 | 19301 | <reponame>best08618/asylo
-- { dg-do compile }
-- { dg-options "-g -gnatVa" }
with Unchecked_Conversion;
procedure Unchecked_Convert7 is
type BPA is array (1 .. 23) of Boolean;
pragma Pack (BPA);
for BPA'Size use 23;
subtype Byte is Natural range 0 .. 255;
type R is
record
S : Boolean;
E : Byte;
F : BPA;
end record;
for R use
record
S at 0 range 0 .. 0;
E at 0 range 1 .. 8;
F at 0 range 9 .. 31;
end record;
for R'Size use 32;
function Conversion
is new Unchecked_Conversion (Source => R, Target => Float);
F : Float := Conversion (R'(False, Byte'Last, (others => False)));
begin
null;
end;
|
src/test/resources/data/generationtests/mdl-include-expected.asm | cpcitor/mdlz80optimizer | 36 | 241200 | ; Test case:
include_label: equ $
label: ; this was inside of the include
nop
loop:
jr loop
__mdlrenamed__end: |
source/amf/uml/amf-uml-activity_partitions.ads | svn2github/matreshka | 24 | 20988 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- An activity partition is a kind of activity group for identifying actions
-- that have some characteristic in common.
------------------------------------------------------------------------------
limited with AMF.UML.Activity_Edges.Collections;
with AMF.UML.Activity_Groups;
limited with AMF.UML.Activity_Nodes.Collections;
limited with AMF.UML.Activity_Partitions.Collections;
limited with AMF.UML.Elements;
package AMF.UML.Activity_Partitions is
pragma Preelaborate;
type UML_Activity_Partition is limited interface
and AMF.UML.Activity_Groups.UML_Activity_Group;
type UML_Activity_Partition_Access is
access all UML_Activity_Partition'Class;
for UML_Activity_Partition_Access'Storage_Size use 0;
not overriding function Get_Edge
(Self : not null access constant UML_Activity_Partition)
return AMF.UML.Activity_Edges.Collections.Set_Of_UML_Activity_Edge is abstract;
-- Getter of ActivityPartition::edge.
--
-- Edges immediately contained in the group.
not overriding function Get_Is_Dimension
(Self : not null access constant UML_Activity_Partition)
return Boolean is abstract;
-- Getter of ActivityPartition::isDimension.
--
-- Tells whether the partition groups other partitions along a dimension.
not overriding procedure Set_Is_Dimension
(Self : not null access UML_Activity_Partition;
To : Boolean) is abstract;
-- Setter of ActivityPartition::isDimension.
--
-- Tells whether the partition groups other partitions along a dimension.
not overriding function Get_Is_External
(Self : not null access constant UML_Activity_Partition)
return Boolean is abstract;
-- Getter of ActivityPartition::isExternal.
--
-- Tells whether the partition represents an entity to which the
-- partitioning structure does not apply.
not overriding procedure Set_Is_External
(Self : not null access UML_Activity_Partition;
To : Boolean) is abstract;
-- Setter of ActivityPartition::isExternal.
--
-- Tells whether the partition represents an entity to which the
-- partitioning structure does not apply.
not overriding function Get_Node
(Self : not null access constant UML_Activity_Partition)
return AMF.UML.Activity_Nodes.Collections.Set_Of_UML_Activity_Node is abstract;
-- Getter of ActivityPartition::node.
--
-- Nodes immediately contained in the group.
not overriding function Get_Represents
(Self : not null access constant UML_Activity_Partition)
return AMF.UML.Elements.UML_Element_Access is abstract;
-- Getter of ActivityPartition::represents.
--
-- An element constraining behaviors invoked by nodes in the partition.
not overriding procedure Set_Represents
(Self : not null access UML_Activity_Partition;
To : AMF.UML.Elements.UML_Element_Access) is abstract;
-- Setter of ActivityPartition::represents.
--
-- An element constraining behaviors invoked by nodes in the partition.
not overriding function Get_Subpartition
(Self : not null access constant UML_Activity_Partition)
return AMF.UML.Activity_Partitions.Collections.Set_Of_UML_Activity_Partition is abstract;
-- Getter of ActivityPartition::subpartition.
--
-- Partitions immediately contained in the partition.
not overriding function Get_Super_Partition
(Self : not null access constant UML_Activity_Partition)
return AMF.UML.Activity_Partitions.UML_Activity_Partition_Access is abstract;
-- Getter of ActivityPartition::superPartition.
--
-- Partition immediately containing the partition.
not overriding procedure Set_Super_Partition
(Self : not null access UML_Activity_Partition;
To : AMF.UML.Activity_Partitions.UML_Activity_Partition_Access) is abstract;
-- Setter of ActivityPartition::superPartition.
--
-- Partition immediately containing the partition.
end AMF.UML.Activity_Partitions;
|
src/fltk-images-pixmaps-xpm.adb | micahwelf/FLTK-Ada | 1 | 19518 | <reponame>micahwelf/FLTK-Ada
with
Interfaces.C,
System;
use type
System.Address;
package body FLTK.Images.Pixmaps.XPM is
function new_fl_xpm_image
(F : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_xpm_image, "new_fl_xpm_image");
pragma Inline (new_fl_xpm_image);
procedure free_fl_xpm_image
(P : in System.Address);
pragma Import (C, free_fl_xpm_image, "free_fl_xpm_image");
pragma Inline (free_fl_xpm_image);
overriding procedure Finalize
(This : in out XPM_Image) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in XPM_Image'Class
then
free_fl_xpm_image (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Pixmap (This));
end Finalize;
package body Forge is
function Create
(Filename : in String)
return XPM_Image is
begin
return This : XPM_Image do
This.Void_Ptr := new_fl_xpm_image
(Interfaces.C.To_C (Filename));
case fl_image_fail (This.Void_Ptr) is
when 1 =>
raise No_Image_Error;
when 2 =>
raise File_Access_Error;
when 3 =>
raise Format_Error;
when others =>
null;
end case;
end return;
end Create;
end Forge;
end FLTK.Images.Pixmaps.XPM;
|
libsrc/input/pv2000/in_Inkey.asm | jpoikela/z88dk | 640 | 164364 | <gh_stars>100-1000
; uint in_Inkey(void)
; 05.2018 suborb
; Read current state of keyboard but only return
; keypress if a single key is pressed.
SECTION code_clib
PUBLIC in_Inkey
PUBLIC _in_Inkey
EXTERN in_keytranstbl
; exit : carry set and HL = 0 for no keys registered
; else HL = ASCII character code
; uses : AF,BC,DE,HL
.in_Inkey
._in_Inkey
ld de,0
ld b,10
loop:
dec b
ld a,9
sub b
out ($20),a
in a,($20)
rlca
rlca
rlca
rlca
and 240
ld c,a
in a,($10)
and 15
or c
jr nz,hitkey
ld a,8 ;Point de to next row
add e
ld e,a
ld a,b
and a
jr nz,loop
.nokey
ld hl,0
scf
ret
hitkey:
; a = key pressed
; e = offset
ld c,8
hitkey_loop:
rlca
jr c,doneinc
inc e
dec c
jr nz,hitkey_loop
doneinc:
; check for shift/func etc
ld bc,80
in a,($40)
bit 2,a
jr nz, done
ld bc,160
bit 1,a
jr nz,done
ld bc,0
done:
ld hl,in_keytranstbl
add hl,bc
add hl,de
ld a,(hl)
cp 255
jr z,nokey
ld l,a
ld h,0
and a
ret
|
oeis/294/A294644.asm | neoneye/loda-programs | 11 | 241558 | ; A294644: Decimal expansion of the real positive solution to x^3 = x + 3.
; Submitted by <NAME>
; 1,6,7,1,6,9,9,8,8,1,6,5,7,1,6,0,9,6,9,7,4,8,1,4,9,7,8,1,2,1,9,5,5,7,2,2,8,7,2,8,2,6,4,8,2,7,2,0,4,5,8,1,6,9,2,1,3,6,9,0,2,4,3,8,6,4,7,5,2,5,1,3,0,0,2,1,7,9,3,2,5,2,8,7,3,6,3,7,8,6,0,8,8,5,1,4,4,8,1,7
mov $1,1
mov $3,$0
mul $3,4
lpb $3
div $6,3
mul $6,2
add $1,$6
add $2,$1
mov $5,$1
mul $1,2
add $6,$2
mul $2,2
sub $3,1
add $5,$2
add $6,$5
lpe
mov $4,10
pow $4,$0
div $2,$4
cmp $7,0
add $2,$7
div $1,$2
mov $0,$1
mod $0,10
|
libsrc/fcntl/spectrum/microdrive/writebyte.asm | andydansby/z88dk-mk2 | 1 | 240119 | <filename>libsrc/fcntl/spectrum/microdrive/writebyte.asm<gh_stars>1-10
;
; Placeholder for writebyte
;
; Stefano - 2/3/2005
;
; $Id: writebyte.asm,v 1.1 2005/03/02 17:29:33 stefano Exp $
XLIB writebyte
.writebyte
ld hl,-1
ld d,h
ld e,l
ret
|
src/04-fib-recursive.asm | enix403/nasm-playground | 0 | 86122 | ; Compile it with:
; nasm -f elf32 fib-recursive.asm -o fib-recursive.o
; gcc -m32 fib-recursive.o -o fib-recursive
;
; Run by executing:
; ./fib-recursive
; Program to calculate fibonacci numbers using recursion
global main
extern printf
extern scanf
section .data
error_msg db "Invalid input", 0x0a, 0x00
output_msg db "Fib(%i) = %i", 0x0a, 0x00
input_prompt db "Enter the number: ", 0
input_format db "%d", 0
number dd 0
section .text
main:
push ebp
mov ebp, esp
push input_prompt
call printf
add esp, 4
push dword number
push input_format
call scanf
add esp, 8
mov ecx, [number]
cmp ecx, 0
jl invalid
push ecx
call calc_fib
push eax
push ecx
push output_msg
call printf
mov eax, 0
jmp epilog
calc_fib:
push ebp
mov ebp, esp
mov eax, [esp + 8]
cmp eax, 1
jle epilog
push eax
mov ebx, eax
sub ebx, 1
push ebx
call calc_fib
add esp, 4
pop ebx
push eax
sub ebx, 2
push ebx
call calc_fib
add esp, 4
pop ebx
add eax, ebx
jmp epilog
invalid:
push error_msg
call printf
mov eax, 1
jmp epilog
epilog:
mov esp, ebp
pop ebp
ret |
uebung7/u7a9.asm | Sebb767/rechnerarchitektur | 1 | 161556 | <gh_stars>1-10
section .text
extern printf
global main
main:
mov eax, 1024 ; some number
; eax = number
; ebx = exit code
; ecx = number - 1
mov ebx, 1 ; initialize exit code with 1 (is power of 2)
mov ecx, eax
sub ecx, 1 ; initialize ecx with eax-1
; A little bit of magic is done here ;)
; If eax == 0, eax & [bitwise and] (eax-1) is zero, the result will be zero. So far, so
; easy. If eax > 0 but has more than one bit set, -1 will only affect the last bit. Therefore
; eax & ecx will result in a non-zero value (higher bits are unaffected) and the jz will
; not fire, so the exit code stays one. If only one bit is set however, -1 will affect all
; bits making the bitwise and result falsy and therefore skips settings ebx to 0 (not power of).
;
test eax,ecx
jz end
mov ebx, 0
end:
; exit
mov eax, 1 ; sys_exit
int 0x80 ; invoke kernel again
section .data
; data section
; format db '%s' ; save string
section .bss
; ram section
; storage: resb 128 ; reserve 128 byte |
alloy4fun_models/trashltl/models/9/iYptypBLoDASSyrve.als | Kaixi26/org.alloytools.alloy | 0 | 687 | open main
pred idiYptypBLoDASSyrve_prop10 {
all f : Protected | always f in Protected
}
pred __repair { idiYptypBLoDASSyrve_prop10 }
check __repair { idiYptypBLoDASSyrve_prop10 <=> prop10o } |
test/Fail/Issue2834.agda | cruhland/agda | 1,989 | 405 | open import Agda.Builtin.Bool
open import Agda.Builtin.Equality
test : (A : Set) (let X = _) (x : X) (p : A ≡ Bool) → Bool
test .Bool true refl = false
test .Bool false refl = true
|
antlr4/src/main/antlr4/com/cloudrain/derecho/sql/parser/generated/Dsl.g4 | linewx/Derecho | 0 | 7152 | grammar Dsl;
expression
: logicalExpression EOF;
logicalExpression
: NULL #value
| BOOLEAN #value
| STRING #value
| DOUBLE #value
| INTEGER #value
| SOURCE '://' logicalExpression '/' logicalExpression #identifier
| IDENT '(' ( logicalExpression (',' logicalExpression)* )? ')' #function
| IDENT(dataSourceExpression)* #dataSource
| LPAREN logicalExpression RPAREN #primaryExpression
| NOT logicalExpression #unaryExpression
| logicalExpression ( MULT | DIV | MOD ) logicalExpression #multiplicativeExpression
| logicalExpression (PLUS | MINUS) logicalExpression #additiveExpression
| logicalExpression (LT | LTEQ | GT | GTEQ) logicalExpression #relationalExpression
| logicalExpression (EQUALS | NOTEQUALS) logicalExpression #equalityExpression
| logicalExpression AND logicalExpression #booleanAndExpression
| logicalExpression OR logicalExpression #booleanOrExpression
;
dataSourceExpression : ('.'IDENT)(CONDITION)?('(' (logicalExpression (',' logicalExpression)*)? ')' )?;
OR : '||' | 'or';
AND : '&&' | 'and';
EQUALS
: '=' | '==';
NOTEQUALS
: '!=' | '<>';
LT : '<';
LTEQ : '<=';
GT : '>';
GTEQ : '>=';
PLUS : '+';
MINUS : '-';
MULT : '*';
DIV : '/';
MOD : '%';
NOT : '!' | 'not';
DOT : '.';
RPAREN: ')';
LPAREN: '(';
SOURCE: 'ems'|'rms'|'external';
INTEGER
: '-'? ('0'..'9')+
;
DOUBLE
: '-'? ('0'..'9')+ '.' ('0'..'9')+
;
CONDITION :'[' .+ ']'
;
ESCAPED_QUOTE : '\\\''
;
STRING
:'\''( ESCAPED_QUOTE | ~ '\'' )* '\''
;
BOOLEAN
: 'true'
| 'false'
;
NULL
: 'null'
;
IDENT
: ('a'..'z' | 'A'..'Z' | '_' ) ('a'..'z' | 'A'..'Z' | '_' | '0'..'9'| '-')*
;
WS : [ \t\n\r]+ -> skip ; |
src/tutorialspoint.com/src/example5.asm | ishirshov/NASM-tutorial-for-Unix | 0 | 105239 | SYS_EXIT equ 1
SYS_WRITE equ 4
STDIN equ 0
STDOUT equ 1
section .data
msg_1 db 'Hello, programmers!', 0xA, 0xD
len_1 equ $ - msg_1
msg_2 db 'Welcome to the world of', 0x20
len_2 equ $ - msg_2
msg_3 db 'Linux assembly programming!', 0xA, 0xD
len_3 equ $ - msg_3
section .text
global _start
_start:
mov ecx, msg_1
mov edx, len_1
call _print
mov ecx, msg_2
mov edx, len_2
call _print
mov ecx, msg_3
mov edx, len_3
call _print
mov eax, SYS_EXIT
int 80h
_print:
mov eax, SYS_WRITE
mov ebx, STDOUT
int 80h
ret |
test/Succeed/Issue2344.agda | pthariensflame/agda | 3 | 16959 | <filename>test/Succeed/Issue2344.agda
{-# OPTIONS --allow-unsolved-metas #-}
-- Andreas, 2016-12-19, issue #2344, reported by oinkium, shrunk by Ulf
-- The function Agda.TypeChecking.Telescope.permuteTel
-- used in the unifier was buggy.
-- {-# OPTIONS -v tc.meta:25 #-}
-- {-# OPTIONS -v tc.lhs:10 #-}
-- {-# OPTIONS -v tc.lhs.unify:100 #-}
-- {-# OPTIONS -v tc.cover:20 #-}
data Nat : Set where
zero : Nat
suc : Nat → Nat
data Fin : Nat → Set where
zero : ∀ n → Fin (suc n)
postulate
T : Nat → Set
mkT : ∀{l} → T l
toNat : ∀ m → Fin m → Nat
-- The underscore in the type signature is originally dependent on A,X,i
-- but then pruned to be dependent on A,X only.
-- The unifier had a problem with this.
toNat-injective : ∀ (A : Set) X i → T (toNat _ i) -- Yellow expected.
toNat-injective A X (zero n) = mkT
-- Should pass.
|
arch/ARM/Nordic/svd/nrf51/nrf51_svd-swi.ads | bosepchuk/Ada_Drivers_Library | 6 | 8190 | -- Copyright (c) 2013, Nordic Semiconductor ASA
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
-- and/or other materials provided with the distribution.
--
-- * Neither the name of Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- This spec has been automatically generated from nrf51.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF51_SVD.SWI is
pragma Preelaborate;
---------------
-- Registers --
---------------
-----------------
-- Peripherals --
-----------------
-- SW Interrupts.
type SWI_Peripheral is record
-- Unused.
UNUSED : aliased HAL.UInt32;
end record
with Volatile;
for SWI_Peripheral use record
UNUSED at 0 range 0 .. 31;
end record;
-- SW Interrupts.
SWI_Periph : aliased SWI_Peripheral
with Import, Address => System'To_Address (16#40014000#);
end NRF51_SVD.SWI;
|
firmware/coreboot/3rdparty/libgfxinit/common/haswell_shared/hw-gfx-gma-ddi_phy_stub.ads | fabiojna02/OpenCellular | 1 | 5996 | <reponame>fabiojna02/OpenCellular
--
-- Copyright (C) 2017 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
with HW.GFX.GMA.DP_Info;
private package HW.GFX.GMA.DDI_Phy_Stub is
subtype DDI_Phy_Port is GPU_Port;
Max_V_Swing : constant DP_Info.DP_Voltage_Swing := DP_Info.VS_Level_0;
type Emph_Array is array (DP_Info.DP_Voltage_Swing) of DP_Info.DP_Pre_Emph;
Max_Pre_Emph : constant Emph_Array := (others => DP_Info.Emph_Level_0);
procedure Set_DP_Signal_Levels
(Port : Digital_Port;
Train_Set : DP_Info.Train_Set) is null;
subtype HDMI_Buf_Trans_Range is DDI_HDMI_Buf_Trans_Range;
procedure Set_HDMI_Signal_Levels
(Port : DDI_Phy_Port;
Level : HDMI_Buf_Trans_Range) is null;
end HW.GFX.GMA.DDI_Phy_Stub;
|
bb-runtimes/examples/tms570-leds/src/tms570-leds.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 18674 | <reponame>JCGobbi/Nucleo-STM32G474RE<filename>bb-runtimes/examples/tms570-leds/src/tms570-leds.adb
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2014, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
package body TMS570.LEDs is
function As_Word is new Ada.Unchecked_Conversion
(Source => User_LED, Target => Word);
--------
-- On --
--------
procedure On (This : User_LED) is
begin
Set_Pin (HET_Port, As_Word (This));
end On;
---------
-- Off --
---------
procedure Off (This : User_LED) is
begin
Clear_Pin (HET_Port, As_Word (This));
end Off;
----------------
-- Initialize --
----------------
procedure Initialize is
begin
-- set all pins as outputs
HET_Port.DIR := 16#FFFF_FFFF#;
end Initialize;
begin
Initialize;
end TMS570.LEDs;
|
src/fs/NextAvalibleFileSlot.asm | beckadamtheinventor/BOSos | 1 | 17998 | <gh_stars>1-10
;find the next avalible file handle
;saves HL
;returns:
; DE = file slot handle pointer
; C = file slot
; Z flag set if success, else failed
fs_NextAvalibleFileSlot:
push hl
ld de,open_files_table
ld c,1
ld hl,8 ; length of file handle
.loop:
ld a,(de)
or a,a
jr z,.success
inc a
jr z,.fail
inc c
ex hl,de
add hl,de
ex hl,de
jr .loop
.success:
pop hl
ret
.fail:
pop hl
inc a
ret
|
programs/oeis/155/A155665.asm | neoneye/loda | 22 | 15533 | ; A155665: 11^n+8^n-1.
; 1,18,184,1842,18736,193818,2033704,21584322,231136096,2492165418,27011166424,293901605202,3207147853456,35072467957818,384147880094344,4212432541504482,46231204840282816,507698828312979018
mov $1,8
pow $1,$0
mov $2,11
pow $2,$0
add $1,$2
mov $0,$1
sub $0,1
|
memory/allocation.asm | urandu/assembly-language | 0 | 104075 | section .text
global _start ;must be declared for using gcc
_start: ;tell linker entry point
mov eax, 45 ;sys_brk
xor ebx, ebx
int 80h
add eax, 16384 ;number of bytes to be reserved
mov ebx, eax
mov eax, 45 ;sys_brk
int 80h
cmp eax, 0
jl exit ;exit, if error
mov edi, eax ;EDI = highest available address
sub edi, 4 ;pointing to the last DWORD
mov ecx, 4096 ;number of DWORDs allocated
xor eax, eax ;clear eax
std ;backward
rep stosd ;repete for entire allocated area
cld ;put DF flag to normal state
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, len
int 80h ;print a message
exit:
mov eax, 1
xor ebx, ebx
int 80h
section .data
msg db "Allocated 16 kb of memory!", 10
len equ $ - msg |
test-suite/programs/unit/jz_0x10.asm | ocus/TinyASM_Haskell | 0 | 178516 | <reponame>ocus/TinyASM_Haskell
MOV [0] 18
MOV [1] 0
MOV [2] 24
MOV [3] 1
JZ [0] [1]
DPRINT 99
HALT
JZ [2] [3]
DPRINT 88
HALT
DPRINT 77
HALT
|
data/special_pointers.asm | pokeachromicdevs/pokeoctober | 1 | 177825 | <reponame>pokeachromicdevs/pokeoctober<gh_stars>1-10
; Special routines can be used with the "special" map script command.
; They often use wScriptVar for arguments and return values.
add_special: MACRO
\1Special::
dba \1
ENDM
SpecialsPointers::
add_special WarpToSpawnPoint ; $0
; Communications
add_special SetBitsForLinkTradeRequest
add_special WaitForLinkedFriend
add_special CheckLinkTimeout
add_special TryQuickSave
add_special CheckBothSelectedSameRoom
add_special FailedLinkToPast
add_special CloseLink
add_special WaitForOtherPlayerToExit ; $8
add_special SetBitsForBattleRequest
add_special SetBitsForTimeCapsuleRequest
add_special CheckTimeCapsuleCompatibility
add_special EnterTimeCapsule
add_special TradeCenter
add_special Colosseum
add_special TimeCapsule
add_special CableClubCheckWhichChris ; $10
add_special CheckMysteryGift
add_special GetMysteryGiftItem
add_special UnlockMysteryGift
; Map events
add_special BugContestJudging
add_special CheckPartyFullAfterContest
add_special ContestDropOffMons
add_special ContestReturnMons
add_special GiveParkBalls ; $18
add_special CheckMagikarpLength
add_special MagikarpHouseSign
add_special HealParty ; this is both a special and a predef
add_special PokemonCenterPC
add_special PlayersHousePC
add_special DayCareMan
add_special DayCareLady
add_special DayCareManOutside ; $20
add_special MoveDeletion
add_special BankOfMom
add_special MagnetTrain
add_special NameRival
add_special SetDayOfWeek
add_special OverworldTownMap
add_special UnownPrinter
add_special MapRadio ; $28
add_special UnownPuzzle
add_special SlotMachine
add_special CardFlip
add_special DummyNonfunctionalGameCornerGame
add_special ClearBGPalettesBufferScreen
add_special FadeOutPalettes
add_special BattleTowerFade
add_special FadeBlackQuickly ; $30
add_special FadeInPalettes
add_special FadeInQuickly
add_special ReloadSpritesNoPalettes ; bank 0
add_special ClearBGPalettes ; bank 0
add_special UpdateTimePals ; bank 0
add_special ClearTileMap ; bank 0
add_special UpdateSprites ; bank 0
add_special ReplaceKrisSprite ; $38 ; bank 0
add_special GameCornerPrizeMonCheckDex
add_special UnusedSetSeenMon
add_special WaitSFX ; bank 0
add_special PlayMapMusic ; bank 0
add_special RestartMapMusic ; bank 0
add_special HealMachineAnim
add_special SurfStartStep
add_special FindPartyMonAboveLevel ; $40
add_special FindPartyMonAtLeastThatHappy
add_special FindPartyMonThatSpecies
add_special FindPartyMonThatSpeciesYourTrainerID
add_special UnusedCheckUnusedTwoDayTimer
add_special DayCareMon1
add_special DayCareMon2
add_special SelectRandomBugContestContestants
add_special ActivateFishingSwarm ; $48
add_special ToggleMaptileDecorations
add_special ToggleDecorationsVisibility
add_special GiveShuckle
add_special ReturnShuckle
add_special BillsGrandfather
add_special CheckPokerus
add_special DisplayCoinCaseBalance
add_special DisplayMoneyAndCoinBalance ; $50
add_special PlaceMoneyTopRight
add_special CheckForLuckyNumberWinners
add_special CheckLuckyNumberShowFlag
add_special ResetLuckyNumberShowFlag
add_special PrintTodaysLuckyNumber
add_special SelectApricornForKurt
add_special NameRater
add_special DisplayLinkRecord ; $58
add_special GetFirstPokemonHappiness
add_special CheckFirstMonIsEgg
add_special RandomUnseenWildMon
add_special RandomPhoneWildMon
add_special RandomPhoneMon
add_special LoadUsedSpritesGFX
add_special PlaySlowCry
add_special SnorlaxAwake ; $60
add_special OlderHaircutBrother
add_special YoungerHaircutBrother
add_special DaisysGrooming
add_special PlayCurMonCry
add_special ProfOaksPCBoot
add_special GameboyCheck
add_special TrainerHouse
add_special PhotoStudio ; $68
add_special InitRoamMons
add_special FadeOutMusic
add_special Diploma
add_special PrintDiploma
; Crystal only
add_special Function11ac3e
add_special Function11b444
add_special Function11b5e8
add_special Function11b7e5 ; $70
add_special Function11b879
add_special Function11b920
add_special Function11b93b
add_special BattleTowerRoomMenu
add_special Function1700ba
add_special Function170114
add_special BattleTowerBattle
add_special Function1704e1 ; $78
add_special DummySpecial_17021d
add_special LoadOpponentTrainerAndPokemonWithOTSprite
add_special Function11ba38
add_special CheckForBattleTowerRules
add_special GiveOddEgg
add_special Reset ; bank 0
add_special Function1011f1
add_special Function101220 ; $80
add_special Function101225
add_special Function101231
add_special MoveTutor
add_special OmanyteChamber
add_special Function11c1ab
add_special BattleTowerAction
add_special DisplayUnownWords
add_special Menu_ChallengeExplanationCancel ; $88
add_special Function17d2b6
add_special Function17d2ce
add_special BattleTowerMobileError
add_special AskMobileOrCable
add_special HoOhChamber
add_special Function102142
add_special CelebiShrineEvent
add_special CheckCaughtCelebi ; $90
add_special PokeSeer
add_special BuenasPassword
add_special BuenaPrize
add_special GiveDratini
add_special SampleKenjiBreakCountdown
add_special BeastsCheck
add_special MonCheck
add_special SetPlayerPalette ; $98
add_special DummySpecial_170bd2
add_special Mobile_SelectThreeMons
add_special Function1037eb
add_special Function10383c
add_special StubbedTrainerRankings_Healings
add_special RefreshSprites
add_special Function1037c2
add_special Mobile_DummyReturnFalse ; $a0
add_special Function103780
add_special Function10387b
add_special AskRememberPassword
add_special LoadMapPalettes
add_special UnusedFindItemInPCOrBag
add_special InitialSetDSTFlag
add_special InitialClearDSTFlag
add_special DummySpecial_c224 ; $a8
add_special NameMom
|
programs/oeis/099/A099958.asm | jmorken/loda | 1 | 85512 | <reponame>jmorken/loda<gh_stars>1-10
; A099958: (1/2)*number of distinct angular positions under which an observer positioned at the center of an edge of a square lattice can see the (2n)X(2n-1) points symmetrically surrounding his position.
; 1,5,13,23,37,55,75,95,127,157,185,227,263,305,357,403,455,511,571,631,703,769,833,923,997,1069,1169,1245,1329,1443,1535,1631,1743,1849,1957,2075,2195,2307,2439,2565,2683,2845,2957,3097,3265,3385
mov $4,$0
mul $0,2
mov $2,1
lpb $0
mul $0,2
mov $1,$0
div $0,2
add $1,1
sub $2,1
cal $1,10 ; Euler totient function phi(n): count numbers <= n and prime to n.
sub $0,1
add $2,$1
lpe
mov $1,$2
mov $3,$4
mul $3,2
add $1,$3
|
alloy4fun_models/trashltl/models/7/Zeq3wwipucLk4eaRD.als | Kaixi26/org.alloytools.alloy | 0 | 4313 | <gh_stars>0
open main
pred idZeq3wwipucLk4eaRD_prop8 {
always (some f : File | some link.f implies eventually f in Trash)
}
pred __repair { idZeq3wwipucLk4eaRD_prop8 }
check __repair { idZeq3wwipucLk4eaRD_prop8 <=> prop8o } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.