Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
98a4e4f2
Kaydet (Commit)
98a4e4f2
authored
Ara 15, 2012
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
EvalMatrix<XorEvaluator> for Xor
Change-Id: Ib0fdf7f8916a9d31fbcbedad925361d0cbe03b10
üst
c86a9c4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
20 deletions
+9
-20
scmatrix.cxx
sc/source/core/tool/scmatrix.cxx
+9
-20
No files found.
sc/source/core/tool/scmatrix.cxx
Dosyayı görüntüle @
98a4e4f2
...
...
@@ -912,6 +912,14 @@ struct OrEvaluator
OrEvaluator
()
:
mbResult
(
false
)
{}
};
struct
XorEvaluator
{
bool
mbResult
;
void
operate
(
double
fVal
)
{
mbResult
^=
(
fVal
!=
0.0
);
}
bool
result
()
const
{
return
mbResult
;
}
XorEvaluator
()
:
mbResult
(
false
)
{}
};
// Do not short circuit logical operations, in case there are error values
// these need to be propagated even if the result was determined earlier.
template
<
typename
_Evaluator
>
...
...
@@ -959,26 +967,7 @@ double ScMatrixImpl::Xor() const
{
// All elements must be of value type.
// True if an odd number of elements have a non-zero value.
bool
bXor
=
false
;
size_t
nRows
=
maMat
.
size
().
row
,
nCols
=
maMat
.
size
().
column
;
for
(
size_t
i
=
0
;
i
<
nRows
;
++
i
)
{
for
(
size_t
j
=
0
;
j
<
nCols
;
++
j
)
{
mdds
::
mtm
::
element_t
eType
=
maMat
.
get_type
(
i
,
j
);
if
(
eType
!=
mdds
::
mtm
::
element_numeric
&&
eType
!=
mdds
::
mtm
::
element_boolean
)
// assuming a CompareMat this is an error
return
CreateDoubleError
(
errIllegalArgument
);
double
fVal
=
maMat
.
get_numeric
(
i
,
j
);
if
(
!::
rtl
::
math
::
isFinite
(
fVal
))
// DoubleError
return
fVal
;
bXor
^=
(
fVal
!=
0.0
);
}
}
return
bXor
;
return
EvalMatrix
<
XorEvaluator
>
(
maMat
);
}
namespace
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment