fully specifying call to boost::math::pdf

--- src/test/unit/prob/distributions/univariate/discrete/neg_binomial_test.cpp
+++ src/test/unit/prob/distributions/univariate/discrete/neg_binomial_test.cpp
@@ -35,7 +35,7 @@
   double expect [K];
   for(int i = 0 ; i < K; i++)  {
     bin[i] = 0;
-    expect[i] = N * pdf(dist, i);
+    expect[i] = N * boost::math::pdf(dist, i);
   }
   expect[K-1] = N * (1 - cdf(dist, K - 1));

@@ -109,7 +109,7 @@
   double expect [K];
   for(int i = 0 ; i < K; i++)  {
     bin[i] = 0;
-    expect[i] = N * pdf(dist, i);
+    expect[i] = N * boost::math::pdf(dist, i);
   }
   expect[K-1] = N * (1 - cdf(dist, K - 1));


Got rid of crypto_secretbox_xsalsa20poly1305_keygen() as it's apparently not supported in older versions of sodium.

--- wallet/crypto_highlevel.cpp
+++ wallet/crypto_highlevel.cpp
@@ -217,9 +217,7 @@
 std::array<unsigned char, crypto_secretbox_xsalsa20poly1305_KEYBYTES>
 Crypto_HighLevel::GenXSalsa20poly1305RandomKey()
 {
-    std::array<unsigned char, crypto_secretbox_xsalsa20poly1305_KEYBYTES> res;
-    crypto_secretbox_xsalsa20poly1305_keygen(&res.front());
-    return res;
+    return CHL::RandomBytesAs<std::array<unsigned char, crypto_secretbox_xsalsa20poly1305_KEYBYTES>>();
 }

 Crypto_HighLevel::String Crypto_HighLevel::GetOpenSSLErrorMsg()


INTEGRATION: CWS langstatusbar (1.47.2); FILE MERGED 2007/11/19 11:42:27 tl 1.47.2.3: RESYNC: (1.48-1.49); FILE MERGED 2007/10/01 18:37:05 tl 1.47.2.2: RESYNC: (1.47-1.48); FILE MERGED 2007/08/15 14:52:34 cd 1.47.2.1: #i77208# Don't disable popup menu item if popup contains entries and is controlled by popup menu controller

--- framework/source/uielement/menubarmanager.cxx
+++ framework/source/uielement/menubarmanager.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: menubarmanager.cxx,v $
  *
- *  $Revision: 1.49 $
+ *  $Revision: 1.50 $
  *
- *  last change: $Author: hr $ $Date: 2007-11-01 17:49:38 $
+ *  last change: $Author: ihi $ $Date: 2007-11-23 16:48:13 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -1326,7 +1326,6 @@
                                 bPopupMenu = sal_True;
                                 if (PopupMenu*  pThisPopup = pMenu->GetPopupMenu( pMenuItemHandler->nItemId ))
                                     pMenu->EnableItem( pMenuItemHandler->nItemId, pThisPopup->GetItemCount() ? true : false );
-
                             }

                             lcl_CheckForChildren(pMenu, pMenuItemHandler->nItemId);


fixed one possible thread block

fixed one possible thread block

git-svn-id: 0634bf30b6d7a21f2003d4a9f34c102a3ffa6fda@3269 34602234-ff1f-0410-a465-ea8f3b77ab7f

--- src/common/ThreadPool.cpp
+++ src/common/ThreadPool.cpp
@@ -92,7 +92,9 @@

 		SDL_CondSignal(data->pool->threadStartedWork);
 		data->ret = (*func) (param);
+		SDL_mutexP(data->pool->mutex);
 		data->finished = true;
+		SDL_mutexV(data->pool->mutex);
 		SDL_CondSignal(data->finishedSignal);
 		SDL_CondSignal(data->pool->threadFinishedWork);


PositionControl.hpp: inherit from ModuleParams and replace params with ModuleParams type

--- src/modules/mc_pos_control/PositionControl.hpp
+++ src/modules/mc_pos_control/PositionControl.hpp
@@ -41,8 +41,7 @@

 #include <uORB/topics/vehicle_local_position.h>
 #include <uORB/topics/vehicle_local_position_setpoint.h>
-#include <parameters/param.h>
-
+#include <px4_module_params.h>
 #pragma once

 namespace Controller
@@ -77,12 +76,20 @@
  *
  * 	A setpoint that is NAN is considered as not set.
  */
-class PositionControl
+class PositionControl : public ModuleParams
 {
 public:

-	PositionControl();
-	~PositionControl() {};
+	PositionControl(ModuleParams *parent);
+	~PositionControl() = default;
+
+	/**
+	 *	Overwrites certain parameters.
+	 *	Overwrites are required for unit-conversion.
+	 *	This method should only be called if parameters
+	 *	have been updated.
+	 */
+	void overwriteParams();

 	/**
 	 * Update the current vehicle state.
@@ -164,8 +171,6 @@
 	void _interfaceMapping(); /** maps set-points to internal member set-points */
 	void _positionController(); /** applies the P-position-controller */
 	void _velocityController(const float &dt); /** applies the PID-velocity-controller */
-	void _updateParams(); /** updates parameters */
-	void _setParams(); /** sets parameters to internal member */

 	matrix::Vector3f _pos{}; /**< MC position */
 	matrix::Vector3f _vel{}; /**< MC velocity */
@@ -182,42 +187,23 @@
 	Controller::Constraints _constraints{}; /**< variable constraints */
 	bool _skip_controller{false}; /**< skips position/velocity controller. true for stabilized mode */

-	/**
-	 * Position Gains.
-	 * Pp: P-controller gain for position-controller
-	 * Pv: P-controller gain for velocity-controller
-	 * Iv: I-controller gain for velocity-controller
-	 * Dv: D-controller gain for velocity-controller
-	 */
-	matrix::Vector3f _Pp, _Pv, _Iv, _Dv = matrix::Vector3f{0.0f, 0.0f, 0.0f};
-
-	float MPC_THR_MAX{1.0f}; /**< maximum thrust */
-	float MPC_THR_HOVER{0.5f}; /** equilibrium point for the velocity controller */
-	float MPC_THR_MIN{0.0f}; /**< minimum throttle for any position controlled mode */
-	float MPC_MANTHR_MIN{0.0f}; /**< minimum throttle for stabilized mode */
-	float MPC_XY_VEL_MAX{1.0f}; /**< maximum speed in the horizontal direction */
-	float MPC_Z_VEL_MAX_DN{1.0f}; /**< maximum speed in downwards direction */
-	float MPC_Z_VEL_MAX_UP{1.0f}; /**< maximum speed in upwards direction */
-	float MPC_TILTMAX_AIR{1.5}; /**< maximum tilt for any position/velocity controlled mode in radians */
-	float MPC_MAN_TILT_MAX{3.1}; /**< maximum tilt for manual/altitude mode in radians */
-
-	// Parameter handles
-	int _parameter_sub { -1 };
-	param_t MPC_Z_P_h { PARAM_INVALID };
-	param_t MPC_Z_VEL_P_h { PARAM_INVALID };
-	param_t MPC_Z_VEL_I_h { PARAM_INVALID };
-	param_t MPC_Z_VEL_D_h { PARAM_INVALID };
-	param_t MPC_XY_P_h { PARAM_INVALID };
-	param_t MPC_XY_VEL_P_h { PARAM_INVALID };
-	param_t MPC_XY_VEL_I_h { PARAM_INVALID };
-	param_t MPC_XY_VEL_D_h { PARAM_INVALID };
-	param_t MPC_XY_VEL_MAX_h { PARAM_INVALID };
-	param_t MPC_Z_VEL_MAX_DN_h { PARAM_INVALID };
-	param_t MPC_Z_VEL_MAX_UP_h { PARAM_INVALID };
-	param_t MPC_THR_HOVER_h { PARAM_INVALID };
-	param_t MPC_THR_MAX_h { PARAM_INVALID };
-	param_t MPC_THR_MIN_h { PARAM_INVALID };
-	param_t MPC_MANTHR_MIN_h { PARAM_INVALID };
-	param_t MPC_TILTMAX_AIR_h { PARAM_INVALID };
-	param_t MPC_MAN_TILT_MAX_h { PARAM_INVALID };
+	DEFINE_PARAMETERS(
+	        (ParamFloat<px4::params::MPC_THR_MAX>) MPC_THR_MAX,
+			(ParamFloat<px4::params::MPC_THR_HOVER>) MPC_THR_HOVER,
+			(ParamFloat<px4::params::MPC_THR_MIN>) MPC_THR_MIN,
+			(ParamFloat<px4::params::MPC_MANTHR_MIN>) MPC_MANTHR_MIN,
+			(ParamFloat<px4::params::MPC_XY_VEL_MAX>) MPC_XY_VEL_MAX,
+			(ParamFloat<px4::params::MPC_Z_VEL_MAX_DN>) MPC_Z_VEL_MAX_DN,
+			(ParamFloat<px4::params::MPC_Z_VEL_MAX_UP>) MPC_Z_VEL_MAX_UP,
+			(ParamFloat<px4::params::MPC_TILTMAX_AIR>) MPC_TILTMAX_AIR,
+			(ParamFloat<px4::params::MPC_MAN_TILT_MAX>) MPC_MAN_TILT_MAX,
+			(ParamFloat<px4::params::MPC_Z_P>) MPC_Z_P,
+			(ParamFloat<px4::params::MPC_Z_VEL_P>) MPC_Z_VEL_P,
+			(ParamFloat<px4::params::MPC_Z_VEL_I>) MPC_Z_VEL_I,
+			(ParamFloat<px4::params::MPC_Z_VEL_D>) MPC_Z_VEL_D,
+			(ParamFloat<px4::params::MPC_XY_P>) MPC_XY_P,
+			(ParamFloat<px4::params::MPC_XY_VEL_P>) MPC_XY_VEL_P,
+			(ParamFloat<px4::params::MPC_XY_VEL_I>) MPC_XY_VEL_I,
+			(ParamFloat<px4::params::MPC_XY_VEL_D>) MPC_XY_VEL_D
+	)
 };


BufferObject: add support for sub-data

BufferObject: add support for sub-data

--- allocore/allocore/graphics/al_BufferObject.hpp
+++ allocore/allocore/graphics/al_BufferObject.hpp
@@ -105,14 +105,14 @@
 	*/
 	enum BufferUsage{
 		STREAM_DRAW		= GL_STREAM_DRAW,
-//		STREAM_READ		= GL_STREAM_READ,
-//		STREAM_COPY		= GL_STREAM_COPY,
+		//STREAM_READ		= GL_STREAM_READ,
+		//STREAM_COPY		= GL_STREAM_COPY,
 		STATIC_DRAW		= GL_STATIC_DRAW,
-//		STATIC_READ		= GL_STATIC_READ,
-//		STATIC_COPY		= GL_STATIC_COPY,
+		//STATIC_READ		= GL_STATIC_READ,
+		//STATIC_COPY		= GL_STATIC_COPY,
 		DYNAMIC_DRAW	= GL_DYNAMIC_DRAW,
-//		DYNAMIC_READ	= GL_DYNAMIC_READ,
-//		DYNAMIC_COPY	= GL_DYNAMIC_COPY
+		//DYNAMIC_READ	= GL_DYNAMIC_READ,
+		//DYNAMIC_COPY	= GL_DYNAMIC_COPY
 	};

@@ -125,6 +125,9 @@

 	void bufferType(BufferType v){ mType=v; }
+
+	void usage(BufferUsage v){ mUsage=v; }
+
 	void mapMode(AccessMode v){ mMapMode=v; }

 	void operator()(){
@@ -165,6 +168,15 @@
 	bool unmap(){ return glUnmapBuffer(mType)==GL_TRUE; }
 #endif

+	/// Set size, in bytes, of buffer without sending data
+	void resize(int numBytes){
+		mData = NULL;
+		mDataType = Graphics::BYTE;
+		mNumElems = numBytes;
+		mNumComps = 1;
+		data();
+	}
+
 	/// Set buffer data store and copy over client data
 	void data(const void * src, Graphics::DataType dataType, int numElems, int numComps=1){
 		mData = (void *)src;
@@ -192,6 +204,16 @@
 		unbind();
 	}

+	/// Set subregion of buffer store
+	template <class T>
+	int subData(const T * src, int numElems, int byteOffset=0){
+		if(numElems){
+			bind();
+			glBufferSubData(mType, byteOffset, numElems*sizeof(T), src);
+			unbind();
+		}
+		return numElems*sizeof(T) + byteOffset;
+	}

 protected:
 	AccessMode mMapMode;
@@ -260,7 +282,7 @@
 	:	BufferObject(ELEMENT_ARRAY_BUFFER, usage), mPrim(prim), mStart(0), mEnd(0)
 	{}

-	EBO& prim(Graphics::Primitive v){ mPrim=v; return *this; }
+	EBO& primitive(Graphics::Primitive v){ mPrim=v; return *this; }
 	EBO& range(int start, int end){ mStart=start; mEnd=end; return *this; }

 protected:


ENH: QToolBar in QDockWidget test.

ENH: QToolBar in QDockWidget test.

--- Code/Application/Catalogue/mvdMainWindow.cxx
+++ Code/Application/Catalogue/mvdMainWindow.cxx
@@ -702,6 +702,20 @@
 MainWindow
 ::InitializeDockWidgets()
 {
+#define ENABLE_QTOOLBAR_TEST 1
+#if ENABLE_QTOOLBAR_TEST
+  // XP: QToolBar test.
+  QDockWidget* dock =
+    AddWidgetToDock(
+      m_UI->m_ToolBar,
+      "TOOL_BAR",
+      tr( "Tool bar" ),
+      Qt::TopDockWidgetArea
+    );
+
+  m_UI->menu_View->addAction( dock->toggleViewAction() );
+#endif
+
   //
   // Left pane.


better output report control with -O option

--- unstructTestHDF5/cmdLineOptions.C
+++ unstructTestHDF5/cmdLineOptions.C
@@ -101,7 +101,7 @@
           break;
         case 'O':
           choice         = tolower(optarg[0]);
-          luaStyleOutput = ( choice == 'b' || choice == 'l')
+          luaStyleOutput = ( choice == 'b' || choice == 'l');
           break;
         case 'p':
           maxWritersPer = strtol(optarg, (char **) NULL, 10);


fdo#75489 Pass toolbar context menu commands to toolbar for handling.

The toolbar context menu is handled by the toolbar manager, however
the items are provided and managed by the toolbar itself -- previously
any events on the list of toolbar items in the context menu were silently
discarded, whereas now we pass them on to the owning toolbar.

Change-Id: Ia17718c3ff8acfba1b6d655022dd9469932f3493

--- framework/source/uielement/toolbarmanager.cxx
+++ framework/source/uielement/toolbarmanager.cxx
@@ -1905,6 +1905,7 @@
             {
                 sal_uInt16 nId = pMenu->GetCurItemId();
                 if(( nId > 0 ) && ( nId < TOOLBOX_MENUITEM_START ))
+                // Items in the "enable/disable" sub-menu
                 {
                     // toggle toolbar button visibility
                     OUString aCommand = pMenu->GetItemCommand( nId );
@@ -1967,6 +1968,14 @@
                         }
                     }
                 }
+                else
+                // The list of "hidden items", i.e. items which are disabled on
+                // the toolbar hence shown in the context menu for easier access,
+                // which are managed by the owning toolbar.
+                {
+                    m_pToolBar->TriggerItem( pMenu->GetCurItemId()
+                                             - TOOLBOX_MENUITEM_START );
+                }
                 break;
             }
         }


* added a mutex lock around getCurrent() to protect against the sound thread   (needs to be tested on windows, should probably add the debug message there    as well)

--- src/common/TimeKeeper.cxx
+++ src/common/TimeKeeper.cxx
@@ -13,7 +13,7 @@
 // interface header
 #include "TimeKeeper.h"

-// system implementation headers
+// system headers
 #include <time.h>
 #include <string>
 #include <string.h>
@@ -39,10 +39,37 @@
 static DWORD             timeLastCalibration;
 #endif // !defined(_WIN32)

-// common implementation headers
+// system threading headers
+#ifndef _WIN32
+#  include <sys/types.h>
+#  include <dirent.h>
+#endif
+#ifdef HAVE_PTHREADS
+#  include <pthread.h>
+#endif
+
+// common headers
 #include "TextUtils.h"
 #include "bzfio.h"

+
+//============================================================================//
+
+#if defined(HAVE_PTHREADS)
+  static pthread_mutex_t    timer_mutex;
+# define LOCK_TIMER_MUTEX   pthread_mutex_lock(&timer_mutex);
+# define UNLOCK_TIMER_MUTEX pthread_mutex_unlock(&timer_mutex);
+#elif defined(_WIN32)
+  static CRITICAL_SECTION   timer_critical;
+# define LOCK_TIMER_MUTEX   EnterCriticalSection(&timer_critical);
+# define UNLOCK_TIMER_MUTEX LeaveCriticalSection(&timer_critical);
+#else
+# define LOCK_TIMER_MUTEX
+# define UNLOCK_TIMER_MUTEX
+#endif
+
+
+//============================================================================//

 static TimeKeeper currentTime;
 static TimeKeeper tickTime;
@@ -52,6 +79,9 @@
 static TimeKeeper startTime = TimeKeeper::getCurrent();

+//============================================================================//
+
+
 #if !defined(_WIN32)
 static inline int64_t getEpochMicroseconds()
 {
@@ -65,6 +95,8 @@

 const TimeKeeper& TimeKeeper::getCurrent(void)
 {
+  LOCK_TIMER_MUTEX
+
   // if not first call then update current time, else use default initial time
 #if !defined(_WIN32)
   if (lastTime == 0) {
@@ -149,6 +181,9 @@
     }
   }
 #endif /* !defined(_WIN32) */
+
+  UNLOCK_TIMER_MUTEX
+
   return currentTime;
 }


ENH: ROI should not be filled (odd when viewing large regions)

--- Code/Common/Gui/mvdQuicklookViewRenderer.cxx
+++ Code/Common/Gui/mvdQuicklookViewRenderer.cxx
@@ -130,7 +130,7 @@

   m_GlRoiActor->SetColor( color );
   */
-  m_GlRoiActor->SetFill( true );
+  m_GlRoiActor->SetFill( false );
   m_GlRoiActor->SetAlpha( 0.2 );

   m_GlView->MoveActorToEndOfRenderingOrder( key, true );


updated INSStaggeredStokesOperator.C to work with NULL BC objects

--- src/navier_stokes/INSStaggeredStokesOperator.C
+++ src/navier_stokes/INSStaggeredStokesOperator.C
@@ -222,7 +222,7 @@
     U_P_components[0] = U_scratch_component;
     U_P_components[1] = P_scratch_component;
     INSStaggeredPressureBcCoef* P_bc_coef = dynamic_cast<INSStaggeredPressureBcCoef*>(d_P_bc_coef);
-    P_bc_coef->setVelocityNewPatchDataIndex(U_scratch_idx);
+    if (P_bc_coef != NULL) P_bc_coef->setVelocityNewPatchDataIndex(U_scratch_idx);
     d_U_P_bdry_fill_op->setHomogeneousBc(homogeneous_bc);
     d_U_P_bdry_fill_op->resetTransactionComponents(U_P_components);
     d_U_P_bdry_fill_op->fillData(d_new_time);
@@ -240,7 +240,7 @@
         U_scratch_idx, U_scratch_sc_var, d_no_fill_op, d_new_time,
         1.0,
         U_out_idx, U_out_sc_var);
-    d_U_bc_helper->zeroValuesAtDirichletBoundaries(U_out_idx);
+    if (!d_U_bc_helper.isNull()) d_U_bc_helper->zeroValuesAtDirichletBoundaries(U_out_idx);

     d_hier_math_ops->div(
         P_out_idx, P_out_cc_var,


Reset in-memory log data after restore

Reset in-memory log data after restore

--- urbackupserver/server_channel.cpp
+++ urbackupserver/server_channel.cpp
@@ -1319,7 +1319,9 @@
 		else
 		{
 			backup_dao.deleteRestore(restore_id);
-		}
+		}
+
+		ServerLogger::reset(log_id);

 		client_main->finishRestore(restore_id);
 		ClientMain::cleanupRestoreShare(clientid, restore_ident.value);


Allow use of FV variables with neighborCoupledValue/Gradient

--- framework/src/interfaces/NeighborCoupleable.C
+++ framework/src/interfaces/NeighborCoupleable.C
@@ -26,7 +26,7 @@
 const VariableValue &
 NeighborCoupleable::coupledNeighborValue(const std::string & var_name, unsigned int comp) const
 {
-  const auto * var = getVar(var_name, comp);
+  const auto * var = getVarHelper<MooseVariableField<Real>>(var_name, comp);
   if (_neighbor_nodal)
     return (_c_is_implicit) ? var->dofValuesNeighbor() : var->dofValuesOldNeighbor();
   else
@@ -150,7 +150,7 @@
   if (_neighbor_nodal)
     mooseError("Nodal variables do not have gradients");

-  const auto * var = getVar(var_name, comp);
+  const auto * var = getVarHelper<MooseVariableField<Real>>(var_name, comp);
   return (_c_is_implicit) ? var->gradSlnNeighbor() : var->gradSlnOldNeighbor();
 }


Check correct setting, for if client update should be downloaded

--- urbackupserver/server_cleanup.cpp
+++ urbackupserver/server_cleanup.cpp
@@ -209,7 +209,7 @@

 				ScopedActiveThread sat;

-				if( settings->getValue("autoupdate_clients", "true")=="true" )
+				if( settings->getValue("download_client", "true")=="true" )
 				{
 					ServerUpdate upd;
 					upd.update_client();


Print some errors when texture loading failed

--- src/common/obj_loader.cpp
+++ src/common/obj_loader.cpp
@@ -5,6 +5,7 @@
 #include <cstddef>
 #include <iostream>
 #include <limits>
+#include <ostream>
 #include <map>
 #include <utility>

@@ -393,6 +394,8 @@
             auto mat_it = matlib.find(std::string(mtl_name));
             if (mat_it != matlib.end())
             {
+                typedef model::tex_list::value_type tex_type;
+
                 plastic<float> mat;
                 mat.set_ca( from_rgb(mat_it->second.ka) );
                 mat.set_cd( from_rgb(mat_it->second.kd) );
@@ -403,49 +406,59 @@
                 mat.set_specular_exp( mat_it->second.ns );
                 mod.materials.push_back(mat);

-                typedef model::tex_list::value_type tex_type;
-                boost::filesystem::path p(filename);
-                std::string tex_filename = p.parent_path().string() + "/" + mat_it->second.map_kd;
-                std::replace(tex_filename.begin(), tex_filename.end(), '\\', '/');
-
-                if (!mat_it->second.map_kd.empty() && boost::filesystem::exists(tex_filename))
+                if (!mat_it->second.map_kd.empty()) // File path specified in mtl file
                 {
-                    image img;
-                    if (img.load(tex_filename))
+                    boost::filesystem::path p(filename);
+                    std::string tex_filename = p.parent_path().string() + "/" + mat_it->second.map_kd;
+                    std::replace(tex_filename.begin(), tex_filename.end(), '\\', '/');
+
+                    if (boost::filesystem::exists(tex_filename))
                     {
-                        tex_type tex(img.width(), img.height());
-                        tex.set_address_mode( Wrap );
-                        tex.set_filter_mode( Linear );
-
-                        if (img.format() == PF_RGBA16UI)
+                        image img;
+                        if (img.load(tex_filename))
                         {
-                            // Get rid of alpha channel and down-convert to 8-bit
-                            auto data_ptr = reinterpret_cast<vector<4, unorm<16>> const*>(img.data());
-                            tex.set_data(data_ptr, PF_RGBA16UI, PF_RGB8, PremultiplyAlpha);
-                        }
-                        else if (img.format() == PF_RGBA8)
-                        {
-                            // Just get rid of alpha channel
-                            auto data_ptr = reinterpret_cast<vector<4, unorm< 8>> const*>(img.data());
-                            tex.set_data(data_ptr, PF_RGBA8, PF_RGB8, PremultiplyAlpha);
-                        }
-                        else if (img.format() == PF_RGB16UI)
-                        {
-                            // Down-convert to 8-bit
-                            auto data_ptr = reinterpret_cast<tex_type::value_type const*>(img.data());
-                            tex.set_data(data_ptr, PF_RGB16UI, PF_RGB8);
-                        }
-                        else if (img.format() == PF_RGB8)
-                        {
-                            auto data_ptr = reinterpret_cast<tex_type::value_type const*>(img.data());
-                            tex.set_data(data_ptr);
+                            tex_type tex(img.width(), img.height());
+                            tex.set_address_mode( Wrap );
+                            tex.set_filter_mode( Linear );
+
+                            if (img.format() == PF_RGBA16UI)
+                            {
+                                // Get rid of alpha channel and down-convert to 8-bit
+                                auto data_ptr = reinterpret_cast<vector<4, unorm<16>> const*>(img.data());
+                                tex.set_data(data_ptr, PF_RGBA16UI, PF_RGB8, PremultiplyAlpha);
+                            }
+                            else if (img.format() == PF_RGBA8)
+                            {
+                                // Just get rid of alpha channel
+                                auto data_ptr = reinterpret_cast<vector<4, unorm< 8>> const*>(img.data());
+                                tex.set_data(data_ptr, PF_RGBA8, PF_RGB8, PremultiplyAlpha);
+                            }
+                            else if (img.format() == PF_RGB16UI)
+                            {
+                                // Down-convert to 8-bit
+                                auto data_ptr = reinterpret_cast<tex_type::value_type const*>(img.data());
+                                tex.set_data(data_ptr, PF_RGB16UI, PF_RGB8);
+                            }
+                            else if (img.format() == PF_RGB8)
+                            {
+                                auto data_ptr = reinterpret_cast<tex_type::value_type const*>(img.data());
+                                tex.set_data(data_ptr);
+                            }
+                            else
+                            {
+                                std::cerr << "Error: unsupported pixel format\n";
+                            }
+
+                            mod.textures.push_back(std::move(tex));
                         }
                         else
                         {
-                            assert( 0 /* TODO */ );
+                            std::cerr << "Error: cannot load texture from file: " << tex_filename << '\n';
                         }
-
-                        mod.textures.push_back(std::move(tex));
+                    }
+                    else
+                    {
+                        std::cerr << "Error: file does not exist: " << tex_filename << '\n';
                     }
                 }


simple_spin: use file-scope global not function

function-scoped globals are protected by a mutex, and taking a mutex
inside a spin lock implementation kind of defeats the point...

Signed-off-by: Colin McCabe <7b35906f1d014e74a9dc8c913eb229119df647aa@dreamhost.com>

--- src/common/simple_spin.cc
+++ src/common/simple_spin.cc
@@ -18,11 +18,11 @@
 #include <stdint.h>
 #include <pthread.h>

+static uint32_t bar = 13;
+static uint32_t *foo = &bar;
+
 void simple_spin_lock(simple_spinlock_t *lock)
 {
-  static uint32_t bar = 13;
-  static uint32_t *foo = &bar;
-
   while(1) {
     __sync_synchronize();
     uint32_t oldval = *lock;


[WIP] Add returnOptimum parameter in SplineGradientBased

--- src/path-optimization/spline-gradient-based.cc
+++ src/path-optimization/spline-gradient-based.cc
@@ -734,6 +734,7 @@
         bool alwaysStopAtFirst = problem().getParameter ("SplineGradientBased/alwaysStopAtFirst", true);
         bool linearizeAtEachStep = problem().getParameter ("SplineGradientBased/linearizeAtEachStep", false);
         bool checkJointBound = problem().getParameter ("SplineGradientBased/checkJointBound", true);
+        bool returnOptimum = problem().getParameter ("SplineGradientBased/returnOptimum", false);

         PathVectorPtr_t input = PathVector::create (robot_->configSize(), robot_->numberDof());
         path->flatten(input);
@@ -788,7 +789,7 @@
         bool noCollision = true, stopAtFirst = alwaysStopAtFirst;
         bool minimumReached = false;

-        bool computeOptimum = true, computeInterpolatedSpline = true;
+        bool computeOptimum = true, computeInterpolatedSpline = !returnOptimum;

         value_type alpha = alphaInit;

@@ -830,8 +831,13 @@
           }

           // 6.3.2 Check for collision
-          reports = validatePath (*currentSplines, stopAtFirst);
-          noCollision = reports.empty();
+          if (!returnOptimum) {
+            reports = validatePath (*currentSplines, stopAtFirst);
+            noCollision = reports.empty();
+          } else {
+            minimumReached = true;
+            noCollision = true;
+          }
           if (noCollision) {
             cost.value(optimalCost, *currentSplines);
             hppDout (info, "Cost interval: [" << optimalCost << ", " << costLowerBound << "]");


tool/res_build/resource_compiler/render_config: added missing fail-jump.

--- tool/res_build/src/togo/tool_res_build/resource_compiler/render_config.cpp
+++ tool/res_build/src/togo/tool_res_build/resource_compiler/render_config.cpp
@@ -461,6 +461,7 @@
 				"pipe '%.*s' defined again",
 				kvs::name_size(k_pipe), kvs::name(k_pipe)
 			);
+			goto l_failed;
 		}
 		hash_map::set(used, kvs::name_hash(k_pipe), &k_pipe);
 	}


Corrected comparison of the approximation errors between FLEXIBLEAUTO… (#77)

* Corrected comparison of the approximation errors between FLEXIBLEAUTO and FLEXIBLEAUTOEXT

* Changed ring dimension for test cases with approximation error comparison

Co-authored-by: Dmitriy Suponitskiy <32467c76719f8bd5a53a0bf9e3a8561b5499d5ba@dualitytech.com>

--- src/pke/unittest/utckksrns/UnitTestCKKSrns.cpp
+++ src/pke/unittest/utckksrns/UnitTestCKKSrns.cpp
@@ -153,15 +153,15 @@
 }
 //===========================================================================================================
 /***
- * ORDER: Cyclotomic order. Must be a power of 2 for CKKS. RING_DIM = cyclOrder / 2
  * NUMPRIME: Number of towers comprising the ciphertext modulus. MultDepth = NUMPRIME - 1
  * SCALE: Scaling factor bit-length.
- *UnitTestCKKSrns.cpp       Should fit into a machine word, i.e., less than 64.
+ *        Should fit into a machine word, i.e., less than 64.
  * RELIN: The bit decomposition count used in BV relinearization.
  * BATCH: The length of the packed vectors to be used with CKKS.
  */
 constexpr usint RING_DIM = 512;
 constexpr usint RING_DIM_HALF = 256;
+constexpr usint RING_DIM_PREC = 4096; // for test cases with approximation error comparison only
 constexpr usint RELIN    = 10;
 constexpr usint BATCH    = 8;
 #if NATIVEINT == 128
@@ -169,7 +169,7 @@
 #else
 constexpr usint SCALE = 50;
 #endif
-constexpr uint32_t MIN_PRECISION_DIFF = 2; // this is the minimal difference expected between approximation error/precision for FLEXIBLEAUTO and FLEXIBLEAUTOEXT
+constexpr double MIN_PRECISION_DIFF = 1.5; // this is the minimal difference expected between approximation error/precision for FLEXIBLEAUTO and FLEXIBLEAUTOEXT
 // clang-format off
 static std::vector<TEST_CASE_UTCKKSRNS> testCases = {
     // TestType,  Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech,          LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots
@@ -182,9 +182,9 @@
     { ADD_PACKED, "06", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTO,    DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0},
     { ADD_PACKED, "07", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0},
     { ADD_PACKED, "08", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0},
-    // TestType,            Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
-    { ADD_PACKED_PRECISION, "01", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
-    { ADD_PACKED_PRECISION, "02", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    // TestType,            Descr, Scheme,         RDim,      MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
+    { ADD_PACKED_PRECISION, "01", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    { ADD_PACKED_PRECISION, "02", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
 #endif
     // ==========================================
     // TestType,  Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech,          LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots
@@ -197,9 +197,9 @@
     { ADD_PACKED, "26", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTO,    DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32},
     { ADD_PACKED, "27", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32},
     { ADD_PACKED, "28", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32},
-    // TestType,            Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
-    { ADD_PACKED_PRECISION, "21", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
-    { ADD_PACKED_PRECISION, "22", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    // TestType,            Descr, Scheme,         RDim,      MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
+    { ADD_PACKED_PRECISION, "21", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    { ADD_PACKED_PRECISION, "22", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
 #endif
     // ==========================================
     // TestType,  Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech,          LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots
@@ -212,9 +212,9 @@
     { ADD_PACKED, "36", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTO,    DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF},
     { ADD_PACKED, "37", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF},
     { ADD_PACKED, "38", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF},
-    // TestType,            Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots,         LowPrec,      HighPrec
-    { ADD_PACKED_PRECISION, "31", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
-    { ADD_PACKED_PRECISION, "32", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    // TestType,            Descr, Scheme,         RDim,      MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots,         LowPrec,      HighPrec
+    { ADD_PACKED_PRECISION, "31", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    { ADD_PACKED_PRECISION, "32", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
 #endif
     // ==========================================
     // TestType,  Descr, Scheme,          RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech,          LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots
@@ -227,11 +227,11 @@
     { MULT_PACKED, "06", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTO,    DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0},
     { MULT_PACKED, "07", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0},
     { MULT_PACKED, "08", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0},
-    // TestType,             Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
-    { MULT_PACKED_PRECISION, "01", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
-    { MULT_PACKED_PRECISION, "02", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
-    { MULT_PACKED_PRECISION, "03", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FIXEDAUTO,    FLEXIBLEAUTO},
-    { MULT_PACKED_PRECISION, "04", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FIXEDAUTO,    FLEXIBLEAUTO},
+    // TestType,             Descr, Scheme,         RDim,      MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
+    { MULT_PACKED_PRECISION, "01", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    { MULT_PACKED_PRECISION, "02", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    { MULT_PACKED_PRECISION, "03", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FIXEDAUTO,    FLEXIBLEAUTO},
+    { MULT_PACKED_PRECISION, "04", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FIXEDAUTO,    FLEXIBLEAUTO},
 #endif
     // ==========================================
     // TestType,  Descr, Scheme,          RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech,          LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots
@@ -244,11 +244,11 @@
     { MULT_PACKED, "16", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTO,    DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0},
     { MULT_PACKED, "17", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0},
     { MULT_PACKED, "18", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0},
-    // TestType,             Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
-    { MULT_PACKED_PRECISION, "11", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
-    { MULT_PACKED_PRECISION, "12", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
-    { MULT_PACKED_PRECISION, "13", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FIXEDAUTO,    FLEXIBLEAUTO},
-    { MULT_PACKED_PRECISION, "14", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FIXEDAUTO,    FLEXIBLEAUTO},
+    // TestType,             Descr, Scheme,         RDim,      MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
+    { MULT_PACKED_PRECISION, "11", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    { MULT_PACKED_PRECISION, "12", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    { MULT_PACKED_PRECISION, "13", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FIXEDAUTO,    FLEXIBLEAUTO},
+    { MULT_PACKED_PRECISION, "14", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    0,     FIXEDAUTO,    FLEXIBLEAUTO},
 #endif
     // ==========================================
     // TestType,  Descr, Scheme,          RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech,          LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots
@@ -261,11 +261,11 @@
     { MULT_PACKED, "26", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTO,    DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH},
     { MULT_PACKED, "27", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH},
     { MULT_PACKED, "28", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH},
-    // TestType,             Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
-    { MULT_PACKED_PRECISION, "21", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH, FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
-    { MULT_PACKED_PRECISION, "22", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH, FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
-    { MULT_PACKED_PRECISION, "23", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH, FIXEDAUTO,    FLEXIBLEAUTO},
-    { MULT_PACKED_PRECISION, "24", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH, FIXEDAUTO,    FLEXIBLEAUTO},
+    // TestType,             Descr, Scheme,         RDim,      MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
+    { MULT_PACKED_PRECISION, "21", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH, FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    { MULT_PACKED_PRECISION, "22", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH, FLEXIBLEAUTO, FLEXIBLEAUTOEXT},
+    { MULT_PACKED_PRECISION, "23", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH, FIXEDAUTO,    FLEXIBLEAUTO},
+    { MULT_PACKED_PRECISION, "24", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    BATCH, FIXEDAUTO,    FLEXIBLEAUTO},
 #endif
     // ==========================================
     // TestType,  Descr, Scheme,          RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech,          LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots
@@ -278,11 +278,11 @@
     { MULT_PACKED, "36", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTO,    DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32},
     { MULT_PACKED, "37", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32},
     { MULT_PACKED, "38", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32},
-    // TestType,             Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
-    { MULT_PACKED_PRECISION, "31", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FLEXIBLEAUTO, FLEXIBLEAUTOEXT },
-    { MULT_PACKED_PRECISION, "32", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FLEXIBLEAUTO, FLEXIBLEAUTOEXT },
-    { MULT_PACKED_PRECISION, "33", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FIXEDAUTO,    FLEXIBLEAUTO },
-    { MULT_PACKED_PRECISION, "34", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FIXEDAUTO,    FLEXIBLEAUTO },
+    // TestType,             Descr, Scheme,         RDim,      MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots, LowPrec,      HighPrec
+    { MULT_PACKED_PRECISION, "31", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FLEXIBLEAUTO, FLEXIBLEAUTOEXT },
+    { MULT_PACKED_PRECISION, "32", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FLEXIBLEAUTO, FLEXIBLEAUTOEXT },
+    { MULT_PACKED_PRECISION, "33", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FIXEDAUTO,    FLEXIBLEAUTO },
+    { MULT_PACKED_PRECISION, "34", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    32,    FIXEDAUTO,    FLEXIBLEAUTO },
 #endif
     // ==========================================
     // TestType,  Descr, Scheme,          RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech,          LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots
@@ -295,11 +295,11 @@
     { MULT_PACKED, "46", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTO,    DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF},
     { MULT_PACKED, "47", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF},
     { MULT_PACKED, "48", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, FLEXIBLEAUTOEXT, DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF},
-    // TestType,             Descr, Scheme,         RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots,         LowPrec,      HighPrec
-    { MULT_PACKED_PRECISION, "41", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FLEXIBLEAUTO, FLEXIBLEAUTOEXT },
-    { MULT_PACKED_PRECISION, "42", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FLEXIBLEAUTO, FLEXIBLEAUTOEXT },
-    { MULT_PACKED_PRECISION, "43", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FIXEDAUTO,    FLEXIBLEAUTO },
-    { MULT_PACKED_PRECISION, "44", {CKKSRNS_SCHEME, RING_DIM, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FIXEDAUTO,    FLEXIBLEAUTO },
+    // TestType,             Descr, Scheme,         RDim,      MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech, LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech, Slots,         LowPrec,      HighPrec
+    { MULT_PACKED_PRECISION, "41", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FLEXIBLEAUTO, FLEXIBLEAUTOEXT },
+    { MULT_PACKED_PRECISION, "42", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FLEXIBLEAUTO, FLEXIBLEAUTOEXT },
+    { MULT_PACKED_PRECISION, "43", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, HYBRID, DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FIXEDAUTO,    FLEXIBLEAUTO },
+    { MULT_PACKED_PRECISION, "44", {CKKSRNS_SCHEME, RING_DIM_PREC, 7,     SCALE,  RELIN, BATCH,   OPTIMIZED,  DFLT,   DFLT,    HEStd_NotSet, BV,     DFLT,   DFLT,    DFLT,  DFLT,   DFLT,      DFLT,       DFLT, DFLT},    RING_DIM_HALF, FIXEDAUTO,    FLEXIBLEAUTO },
 #endif
     // ==========================================
     // TestType,               Descr, Scheme,          RDim, MultDepth, SFBits, RWin,  BatchSz, Mode,       MDepth, ModSize, SecLvl,       KSTech, RSTech,          LDigits, PtMod, StdDev, EvalAddCt, EvalMultCt, KSCt, MultTech
@@ -587,20 +587,11 @@

     // CalculateApproximationError() calculates the precision number (or approximation error).
     // The higher the precision, the less the error.
-    uint32_t CalculateApproximationError(
+    template<typename T>
+    double CalculateApproximationError(
         const std::vector<std::complex<double>>& result,
         const std::vector<std::complex<double>>& expectedResult) {
-        if (result.size() != expectedResult.size())
-            OPENFHE_THROW(config_error, "Cannot compare vectors with different numbers of elements");
-
-        // using the Euclidean norm
-        double avrg = 0;
-        for (size_t i = 0; i < result.size(); ++i) {
-            avrg += std::pow(std::abs(result[i].real() - expectedResult[i].real()), 2);
-        }
-
-        avrg = std::sqrt(avrg) / result.size(); // get the average
-        return std::round(std::abs(std::log2(avrg)) * 10) / 10; // should return an unsigned integer
+            OPENFHE_THROW(not_implemented_error, "CalculateApproximationError() is not implemented for this datatype");
     }

 protected:
@@ -610,7 +601,8 @@
         CryptoContextFactory<DCRTPoly>::ReleaseAllContexts();
     }

-    bool UnitTest_Add_Packed(const TEST_CASE_UTCKKSRNS& testData, std::vector<uint32_t>& approximationErrors, const std::string& failmsg = std::string()) {
+    template<typename T>
+    bool UnitTest_Add_Packed(const TEST_CASE_UTCKKSRNS& testData, std::vector<T>& approximationErrors, const std::string& failmsg = std::string()) {
         try {
             CryptoContext<Element> cc(UnitTestGenerateContext(testData.params));

@@ -640,14 +632,14 @@
             results->SetLength(plaintextAdd->GetLength());
             checkEquality(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalAdd fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             cc->EvalAddInPlace(ciphertext1_mutable, ciphertext2);
             cc->Decrypt(kp.secretKey, ciphertext1_mutable, &results);
             results->SetLength(plaintextAdd->GetLength());
             checkEquality(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalAddInPlace fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing operator+
             cResult = ciphertext1 + ciphertext2;
@@ -655,7 +647,7 @@
             results->SetLength(plaintextAdd->GetLength());
             checkEquality(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " operator+ fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing operator+=
             Ciphertext<Element> caddInplace(ciphertext1);
@@ -664,14 +656,14 @@
             results->SetLength(plaintextAdd->GetLength());
             checkEquality(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " operator+= fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             cResult = cc->EvalSub(ciphertext1, ciphertext2);
             cc->Decrypt(kp.secretKey, cResult, &results);
             results->SetLength(plaintextSub->GetLength());
             checkEquality(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalSub fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing operator-
             cResult = ciphertext1 - ciphertext2;
@@ -679,7 +671,7 @@
             results->SetLength(plaintextSub->GetLength());
             checkEquality(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " operator- fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing operator-=
             Ciphertext<Element> csubInplace(ciphertext1);
@@ -688,7 +680,7 @@
             results->SetLength(plaintextSub->GetLength());
             checkEquality(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " operator-= fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalAdd ciphertext + plaintext
             cResult = cc->EvalAdd(ciphertext1, plaintext2);
@@ -696,7 +688,7 @@
             results->SetLength(plaintextAdd->GetLength());
             checkEquality(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalAdd Ct and Pt fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextAdd->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalSub ciphertext - plaintext
             cResult = cc->EvalSub(ciphertext1, plaintext2);
@@ -704,7 +696,7 @@
             results->SetLength(plaintextSub->GetLength());
             checkEquality(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalSub Ct and Pt fails fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextSub->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalAdd ciphertext + double
             cResult = cc->EvalAdd(ciphertext1, 0.5);
@@ -712,7 +704,7 @@
             results->SetLength(plaintext1AddScalar->GetLength());
             checkEquality(plaintext1AddScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalAdd Ct and Double fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintext1AddScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintext1AddScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalAdd ciphertext - double
             cResult = cc->EvalSub(ciphertext1, 0.5);
@@ -720,7 +712,7 @@
             results->SetLength(plaintext1SubScalar->GetLength());
             checkEquality(plaintext1SubScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalSub Ct and Double fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintext1SubScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintext1SubScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalAdd ciphertext + negative double
             cResult = cc->EvalAdd(ciphertext1, -0.5);
@@ -728,7 +720,7 @@
             results->SetLength(plaintext1SubScalar->GetLength());
             checkEquality(plaintext1SubScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalAdd Ct and negative double fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintext1SubScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintext1SubScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalAdd ciphertext - negative double
             cResult = cc->EvalSub(ciphertext1, -0.5);
@@ -736,7 +728,7 @@
             results->SetLength(plaintext1AddScalar->GetLength());
             checkEquality(plaintext1AddScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalSub Ct and negative double fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintext1AddScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintext1AddScalar->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalNegate
             cResult = cc->EvalNegate(ciphertext1);
@@ -744,7 +736,7 @@
             results->SetLength(negatives1->GetLength());
             checkEquality(negatives1->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalNegate fails");
-            approximationErrors.emplace_back(CalculateApproximationError(negatives1->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(negatives1->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             return true;
         }
@@ -764,20 +756,20 @@
     }

     void UnitTest_Add_Packed(const TEST_CASE_UTCKKSRNS& testData, const std::string& failmsg = std::string()) {
-        std::vector<uint32_t> precisions;
+        std::vector<double> precisions;
         UnitTest_Add_Packed(testData, precisions, failmsg);
     }

     void UnitTest_Add_Packed_Precision(const TEST_CASE_UTCKKSRNS& testData, const std::string& failmsg = std::string()) {
         TEST_CASE_UTCKKSRNS testDataLocal(testData);

-        std::vector<uint32_t> lowPrecisions;
+        std::vector<double> lowPrecisions;
         CryptoContextFactory<DCRTPoly>::ReleaseAllContexts();
         testDataLocal.params.rsTech = testDataLocal.lowerPrecisionTechnique;
         if (!UnitTest_Add_Packed(testDataLocal, lowPrecisions, failmsg))
             return;

-        std::vector<uint32_t> highPrecisions;
+        std::vector<double> highPrecisions;
         CryptoContextFactory<DCRTPoly>::ReleaseAllContexts();
         testDataLocal.params.rsTech = testDataLocal.higherPrecisionTechnique;
         if(!UnitTest_Add_Packed(testDataLocal, highPrecisions, failmsg))
@@ -786,7 +778,8 @@
         checkMinDiff(highPrecisions, lowPrecisions, MIN_PRECISION_DIFF, failmsg + " Approximation errors' comparison failed");
     }

-    bool UnitTest_Mult_Packed(const TEST_CASE_UTCKKSRNS& testData, std::vector<uint32_t>& approximationErrors, const std::string& failmsg = std::string()) {
+    template<typename T>
+    bool UnitTest_Mult_Packed(const TEST_CASE_UTCKKSRNS& testData, std::vector<T>& approximationErrors, const std::string& failmsg = std::string()) {
         try {
             CryptoContext<Element> cc(UnitTestGenerateContext(testData.params));

@@ -815,7 +808,7 @@
             results->SetLength(plaintextMult->GetLength());
             checkEquality(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalMult fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing operator*
             cResult = ciphertext1 * ciphertext2;
@@ -823,7 +816,7 @@
             results->SetLength(plaintextMult->GetLength());
             checkEquality(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " operator* fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing operator*=
             Ciphertext<Element> cmultInplace(ciphertext1);
@@ -832,7 +825,7 @@
             results->SetLength(plaintextMult->GetLength());
             checkEquality(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " operator*= fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalMult ciphertext * plaintext
             cResult = cc->EvalMult(ciphertext1, plaintext2);
@@ -840,7 +833,7 @@
             results->SetLength(plaintextMult->GetLength());
             checkEquality(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalMult Ct and Pt fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalMult ciphertext * positive double
             cResult = cc->EvalMult(ciphertext1, 1.0);
@@ -848,7 +841,7 @@
             results->SetLength(plaintext1->GetLength());
             checkEquality(plaintext1->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalMult Ct and positive double fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintext1->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintext1->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalMult ciphertext * negative double
             cResult = cc->EvalMult(ciphertext1, -1.0);
@@ -858,7 +851,7 @@
             buffer1 << "should be: " << plaintextNeg->GetCKKSPackedValue() << " - we get: " << results->GetCKKSPackedValue();
             checkEquality(plaintextNeg->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalMult Ct and negative double fails; " + buffer1.str());
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextNeg->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextNeg->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             // Testing EvalMultNoRelin ciphertext * ciphertext
             cResult = cc->EvalMultNoRelin(ciphertext1, ciphertext2);
@@ -866,7 +859,7 @@
             results->SetLength(plaintextMult->GetLength());
             checkEquality(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue(), eps,
                 failmsg + " EvalMultNoRelin Ct fails");
-            approximationErrors.emplace_back(CalculateApproximationError(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));
+            approximationErrors.emplace_back(CalculateApproximationError<T>(plaintextMult->GetCKKSPackedValue(), results->GetCKKSPackedValue()));

             return true;
         }
@@ -886,20 +879,20 @@
     }

     void UnitTest_Mult_Packed(const TEST_CASE_UTCKKSRNS& testData, const std::string& failmsg = std::string()) {
-        std::vector<uint32_t> precisions;
+        std::vector<double> precisions;
         UnitTest_Mult_Packed(testData, precisions, failmsg);
     }

     void UnitTest_Mult_Packed_Precision(const TEST_CASE_UTCKKSRNS& testData, const std::string& failmsg = std::string()) {
         TEST_CASE_UTCKKSRNS testDataLocal(testData);

-        std::vector<uint32_t> lowPrecisions;
+        std::vector<double> lowPrecisions;
         CryptoContextFactory<DCRTPoly>::ReleaseAllContexts();
         testDataLocal.params.rsTech = FLEXIBLEAUTO;
         if (!UnitTest_Mult_Packed(testDataLocal, lowPrecisions, failmsg))
             return;

-        std::vector<uint32_t> highPrecisions;
+        std::vector<double> highPrecisions;
         CryptoContextFactory<DCRTPoly>::ReleaseAllContexts();
         testDataLocal.params.rsTech = FLEXIBLEAUTOEXT;
         if (!UnitTest_Mult_Packed(testDataLocal, highPrecisions, failmsg))
@@ -1976,6 +1969,34 @@
         }
     }
 };
+
+template<>
+double UTCKKSRNS::CalculateApproximationError<double>(
+    const std::vector<std::complex<double>>& result,
+    const std::vector<std::complex<double>>& expectedResult) {
+    if (result.size() != expectedResult.size())
+        OPENFHE_THROW(config_error, "Cannot compare vectors with different numbers of elements");
+
+    // using the Euclidean norm
+    double avrg = 0;
+    for (size_t i = 0; i < result.size(); ++i) {
+        avrg += std::pow(std::abs(result[i].real() - expectedResult[i].real()), 2);
+    }
+
+    avrg = std::sqrt(avrg) / result.size(); // get the average
+    return std::abs(std::log2(avrg));
+}
+
+//template<>
+//uint32_t UTCKKSRNS::CalculateApproximationError<int>(
+//    const std::vector<std::complex<double>>& result,
+//    const std::vector<std::complex<double>>& expectedResult) {
+
+//    double err = CalculateApproximationError<double>(result, expectedResult);
+//    return std::round(err * 10) / 10; // should return an unsigned integer
+//}
+
+
 //===========================================================================================================
 TEST_P(UTCKKSRNS, CKKSRNS) {
     setupSignals();


moved Bitmap related global vars into their own struct + some code cleanup

--- win32_handmade/win32_handmade.cpp
+++ win32_handmade/win32_handmade.cpp
@@ -13,51 +13,55 @@
 #include <stdint.h>
 #include "win32_handmade.h"

+struct win32_offscreen_buffer {
+	BITMAPINFO Info;
+	void *Memory;
+	int BytesPerPixel = 4;
+	int Width;
+	int Height;
+	int Pitch;
+};
+
 global_variable bool Running;
 global_variable bool Debug = 0;
-global_variable BITMAPINFO BitmapInfo;
-global_variable void *BitmapMemory;
+global_variable win32_offscreen_buffer GlobalBackBuffer;

-global_variable int BytesPerPixel = 4;
-global_variable int BitmapWidth;
-global_variable int BitmapHeight;
-
-internal void Win32RenderGradient(int XOffset, int YOffset) {
-	int Pitch = BitmapWidth*BytesPerPixel;
-	uint8 *Row = (uint8 *)BitmapMemory;
-	for (int Y = 0; Y < BitmapHeight; ++Y) {
+internal void Win32RenderGradient(win32_offscreen_buffer Buffer, int XOffset, int YOffset) {
+	uint8 *Row = (uint8 *)Buffer.Memory;
+	for (int Y = 0; Y < Buffer.Height; ++Y) {
 		uint32 *Pixel = (uint32 *)Row;
-		for (int X = 0; X < BitmapWidth; ++X) {
+		for (int X = 0; X < Buffer.Width; ++X) {
 			uint8 Blue = (X + XOffset);
 			uint8 Green = (Y + YOffset);
 			uint8 Red = (X + XOffset);
 			*Pixel++ = ((Red << 16) | (Green << 8) | (Blue));
 		}
-		Row += Pitch;
+		Row += Buffer.Pitch;
 	}
 }

-internal void Win32ResizeDIBSection(int Width, int Height) {
-	if (BitmapMemory) {
-		VirtualFree(BitmapMemory,0,MEM_RELEASE);
+internal void Win32ResizeDIBSection(win32_offscreen_buffer *Buffer, int Width, int Height) {
+	if (Buffer->Memory) {
+		VirtualFree(Buffer->Memory,0,MEM_RELEASE);
 	}
-	BitmapWidth = Width;
-	BitmapHeight = Height;
-	BitmapInfo.bmiHeader.biSize = sizeof(BitmapInfo.bmiHeader);
-	BitmapInfo.bmiHeader.biWidth = BitmapWidth;
-	BitmapInfo.bmiHeader.biHeight = -BitmapHeight;
-	BitmapInfo.bmiHeader.biPlanes = 1;
-	BitmapInfo.bmiHeader.biBitCount = 32;
-	BitmapInfo.bmiHeader.biCompression = BI_RGB;
+	Buffer->Width = Width;
+	Buffer->Height = Height;
+	Buffer->Info.bmiHeader.biSize = sizeof(Buffer->Info.bmiHeader);
+	Buffer->Info.bmiHeader.biWidth = Buffer->Width;
+	Buffer->Info.bmiHeader.biHeight = -Buffer->Height;
+	Buffer->Info.bmiHeader.biPlanes = 1;
+	Buffer->Info.bmiHeader.biBitCount = 32;
+	Buffer->Info.bmiHeader.biCompression = BI_RGB;

-	int BitmapMemorySize = (BitmapWidth*BitmapHeight)*BytesPerPixel;
-	BitmapMemory = VirtualAlloc(0, BitmapMemorySize, MEM_COMMIT, PAGE_READWRITE);
+	int BitmapMemorySize = (Buffer->Width*Buffer->Height)*Buffer->BytesPerPixel;
+	Buffer->Memory = VirtualAlloc(0, BitmapMemorySize, MEM_COMMIT, PAGE_READWRITE);
+	Buffer->Pitch = Buffer->Width*Buffer->BytesPerPixel;
 }

-internal void Win32UpdateWindow(HDC DeviceContext, RECT *WindowRect, int X, int Y, int Width, int Height) {
-	int WindowWidth = WindowRect->right - WindowRect->left;
-	int WindowHeight = WindowRect->bottom - WindowRect->top;
-	StretchDIBits(DeviceContext, 0, 0, BitmapWidth, BitmapHeight, 0, 0, WindowWidth, WindowHeight, BitmapMemory, &BitmapInfo, DIB_RGB_COLORS, SRCCOPY);
+internal void Win32DisplayBufferInWindow(HDC DeviceContext, RECT WindowRect, win32_offscreen_buffer Buffer, int X, int Y, int Width, int Height) {
+	int WindowWidth = WindowRect.right - WindowRect.left;
+	int WindowHeight = WindowRect.bottom - WindowRect.top;
+	StretchDIBits(DeviceContext, 0, 0, Buffer.Width, Buffer.Height, 0, 0, WindowWidth, WindowHeight, Buffer.Memory, &Buffer.Info, DIB_RGB_COLORS, SRCCOPY);
 }

 LRESULT CALLBACK Win32MainWindowCallback(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam)
@@ -70,7 +74,7 @@
 			GetClientRect(Window,&WindowRect);
 			int Width = WindowRect.right - WindowRect.left;
 			int Height = WindowRect.bottom - WindowRect.top;
-			Win32ResizeDIBSection(Width, Height);
+			Win32ResizeDIBSection(&GlobalBackBuffer, Width, Height);
 			if (Debug) { OutputDebugStringA("WM_SIZE\n"); }
 		} break;
 		case WM_DESTROY:
@@ -101,7 +105,7 @@
 			int Height = Paint.rcPaint.bottom - Paint.rcPaint.top;
 			RECT WindowRect;
 			GetClientRect(Window, &WindowRect);
-			Win32UpdateWindow(DeviceContext, &WindowRect, X, Y, Width, Height);
+			Win32DisplayBufferInWindow(DeviceContext, WindowRect, GlobalBackBuffer , X, Y, Width, Height);
 			EndPaint(Window,&Paint);
 			if (Debug) { OutputDebugStringA("WM_PAINT\n"); }
 		} break;
@@ -117,7 +121,7 @@

 int CALLBACK WinMain(HINSTANCE Instance, HINSTANCE hPrevInstance, LPSTR CommandLine, int ShowCode) {
 	WNDCLASS WindowClass = {};
-	WindowClass.style = CS_HREDRAW|CS_VREDRAW|CS_OWNDC;
+	WindowClass.style = CS_HREDRAW|CS_VREDRAW;
 	WindowClass.lpfnWndProc = Win32MainWindowCallback;
 	WindowClass.hInstance = Instance;
 	//WindowClass.hIcon = ;
@@ -153,14 +157,14 @@
 					TranslateMessage(&Message);
 					DispatchMessage(&Message);
 				}
-				Win32RenderGradient(XOffset, YOffset);
+				Win32RenderGradient(GlobalBackBuffer, XOffset, YOffset);

 				HDC DeviceContext = GetDC(WindowHandle);
 				RECT WindowRect;
 				GetClientRect(WindowHandle, &WindowRect);
 				int WindowWidth = WindowRect.right - WindowRect.left;
 				int WindowHeight = WindowRect.bottom - WindowRect.top;
-				Win32UpdateWindow(DeviceContext,&WindowRect,0,0,WindowWidth,WindowHeight);
+				Win32DisplayBufferInWindow(DeviceContext, WindowRect, GlobalBackBuffer, 0, 0, WindowWidth, WindowHeight);
 				ReleaseDC(WindowHandle, DeviceContext);
 				++XOffset;
 			}


Minor fixes to make game work with CORGI changes

Fixes to handle minor interface changes necessary after the
CORGI memory usage fix.

Change-Id: I882359153c6e685efa64ebe6bc6076b7c3f3479d

--- src/components/patron.cpp
+++ src/components/patron.cpp
@@ -609,15 +609,19 @@
       patron_data->render_child, action);
 }

+// Note:  This function is static (because it's a collision handler) so we
+// have to explicitly get a pointer to a component if want to use component
+// methods.
 void PatronComponent::CollisionHandler(CollisionData* collision_data,
                                        void* user_data) {
   PatronComponent* patron_component = static_cast<PatronComponent*>(user_data);
-  corgi::ComponentId id = GetComponentId();
-  if (collision_data->this_entity->IsRegisteredForComponent(id)) {
+  if (patron_component->IsRegisteredWithComponent<PatronComponent>(
+          collision_data->this_entity)) {
     patron_component->HandleCollision(collision_data->this_entity,
                                       collision_data->other_entity,
                                       collision_data->this_tag);
-  } else if (collision_data->other_entity->IsRegisteredForComponent(id)) {
+  } else if (patron_component->IsRegisteredWithComponent<PatronComponent>(
+                 collision_data->other_entity)) {
     patron_component->HandleCollision(collision_data->other_entity,
                                       collision_data->this_entity,
                                       collision_data->other_tag);


Preprocess the source file.

Preprocess the source file.

--- src/plugins/cpptools/cpprefactoringchanges.cpp
+++ src/plugins/cpptools/cpprefactoringchanges.cpp
@@ -69,7 +69,8 @@
         file.close();
     }

-    doc = m_snapshot.documentFromSource(source.toLatin1(), fileName);
+    const QByteArray contents = m_snapshot.preprocessedCode(source, fileName);
+    doc = m_snapshot.documentFromSource(contents, fileName);
     doc->check();
     return doc;
 }


if file doesn't exist, check to see if directory is on AFS

--- src/condor_c++_util/afs.C
+++ src/condor_c++_util/afs.C
@@ -123,6 +123,20 @@
 	fs = new SubProc( fs_pathname, args, "r" );
 	answer = fs->parse_output("in cell", "'", "'" );
 	delete fs;
+
+	// file might not be created yet; if answer is NULL, try to find
+	// directory on AFS
+	if (answer == NULL) {
+		int i;
+		for (i = strlen(args); i >= 0 && args[i] != '/'; i--);
+		if (i >= 0) {
+			args[i] = '\0';
+			fs = new SubProc( fs_pathname, args, "r" );
+			answer = fs->parse_output("in cell", "'", "'" );
+			delete fs;
+		}
+	}
+
 	return answer;
 }

@@ -146,6 +160,20 @@
 	fs = new SubProc( fs_pathname, args, "r" );
 	answer = fs->parse_output( "Volume status", "named ", "\n" );
 	delete fs;
+
+	// file might not be created yet; if answer is NULL, try to find
+	// directory on AFS
+	if (answer == NULL) {
+		int i;
+		for (i = strlen(args); i >= 0 && args[i] != '/'; i--);
+		if (i >= 0) {
+			args[i] = '\0';
+			fs = new SubProc( fs_pathname, args, "r" );
+			answer = fs->parse_output("in cell", "'", "'" );
+			delete fs;
+		}
+	}
+
 	return answer;
 }


fixed linux build

fixed linux build

--- src/renderer/editor/spline_geometry_plugin.cpp
+++ src/renderer/editor/spline_geometry_plugin.cpp
@@ -179,7 +179,7 @@
 		drawCursor(editor, *cmp.entity);

 		ImGuiEx::Label("Triangles");
-		ImGui::Text("%d", pg.index_data.size() / (pg.index_type == gpu::DataType::U16 ? 2 : 4) / 3);
+		ImGui::Text("%d", u32(pg.index_data.size() / (pg.index_type == gpu::DataType::U16 ? 2 : 4) / 3));

 		ImGuiEx::Label("Brush size");
 		ImGui::DragFloat("##bs", &m_brush_size, 0.1f, 0, FLT_MAX);


fx wrong cast

fx wrong cast

--- src/Base/FileInfo.cpp
+++ src/Base/FileInfo.cpp
@@ -187,7 +187,7 @@
         buf += "/fileXXXXXX";
     }

-    int id = mkstemp(static_cast<char*>(buf.c_str());
+    int id = mkstemp(const_cast<char*>(buf.c_str()));
     if (id > -1) {
         FILE* file = fdopen(id, "w");
         fclose(file);


ENH:Pass data through that isn't defined

--- graphics/vtkFieldDataToAttributeDataFilter.cxx
+++ graphics/vtkFieldDataToAttributeDataFilter.cxx
@@ -197,6 +197,11 @@
                          this->NormalArrayComponents,
                          this->NormalNormalize);
   this->ConstructFieldData(num, attr);
+
+  ((vtkDataSet *)this->Output)->GetPointData()->PassNoReplaceData(
+	  ((vtkDataSet *)this->Input)->GetPointData());
+  ((vtkDataSet *)this->Output)->GetCellData()->PassNoReplaceData(
+	  ((vtkDataSet *)this->Input)->GetCellData());
 }

 void vtkFieldDataToAttributeDataFilter::PrintSelf(ostream& os,


Fixed crash on pathing as client when aircraft is destroyed

--- AirTrafficScreen.cpp
+++ AirTrafficScreen.cpp
@@ -472,6 +472,11 @@
                         boost::ptr_map<sf::Uint32, Aircraft>::iterator it = Aircrafts.find(Aid);
                         if (it != Aircrafts.end())
                         {
+                            if (Pathing == it->second)
+                            {
+                                Pathing = NULL;
+                            }
+
                             Aircrafts.erase(it);
                         }
                         break;


Avoid triggering buffer overflow detectors

Writing directly into buf.tmp causes the nul-terminator to overflow
into buf.crlf, which upsets some overflow detectors.

Bug: crashpad:289
Change-Id: I241f1ae239ed8360ac5dfd245cb70e919ae73cd1
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1545014
Reviewed-by: Mark Mentovai <f1b5a91d4d6ad523f2610114591c007e75d15084@chromium.org>
Commit-Queue: Joshua Peraza <f5809a5e35ec7e1bd0e25cb0a0b68bb433cf6f17@chromium.org>

--- util/net/http_transport_socket.cc
+++ util/net/http_transport_socket.cc
@@ -394,11 +394,13 @@
       // placed immediately following the used portion of buf.data, even if
       // buf.data is not full.

-      // Not snprintf because non-null terminated is desired.
-      int rv = sprintf(
-          buf.size, "%08x", base::checked_cast<unsigned int>(data_bytes));
-      DCHECK_GE(rv, 0);
+      char tmp[9];
+      int rv = snprintf(tmp,
+                        sizeof(tmp),
+                        "%08x",
+                        base::checked_cast<unsigned int>(data_bytes));
       DCHECK_EQ(static_cast<size_t>(rv), sizeof(buf.size));
+      strncpy(buf.size, tmp, sizeof(buf.size));
       DCHECK_NE(buf.size[sizeof(buf.size) - 1], '\0');

       memcpy(&buf.crlf[0], kCRLFTerminator, kCRLFSize);


Use Vector memtable when bulk loading SpatialDB

--- utilities/spatialdb/spatial_db.cc
+++ utilities/spatialdb/spatial_db.cc
@@ -17,6 +17,7 @@

 #include "rocksdb/cache.h"
 #include "rocksdb/options.h"
+#include "rocksdb/memtablerep.h"
 #include "rocksdb/slice_transform.h"
 #include "rocksdb/table.h"
 #include "rocksdb/db.h"
@@ -655,6 +656,7 @@
     column_family_options.num_levels = 2;
     column_family_options.target_file_size_base = 256 * 1024 * 1024;
     column_family_options.max_mem_compaction_level = 0;
+    column_family_options.memtable_factory.reset(new VectorRepFactory());
   }
   return column_family_options;
 }


Not meant to be checked in.

Not meant to be checked in.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@31334 91177308-0d34-0410-b5e6-96231b3b80d8

--- utils/TableGen/DAGISelEmitter.cpp
+++ utils/TableGen/DAGISelEmitter.cpp
@@ -3552,14 +3552,11 @@
   // Emit boilerplate.
   OS << "SDNode *Select_INLINEASM(SDOperand N) {\n"
      << "  std::vector<SDOperand> Ops(N.Val->op_begin(), N.Val->op_end());\n"
-     << "  AddToISelQueue(N.getOperand(0)); // Select the chain.\n"
+     << "  AddToISelQueue(N.getOperand(0)); // Select the chain.\n\n"
      << "  // Select the flag operand.\n"
      << "  if (Ops.back().getValueType() == MVT::Flag)\n"
      << "    AddToISelQueue(Ops.back());\n"
      << "  SelectInlineAsmMemoryOperands(Ops, *CurDAG);\n"
-     << "  for (unsigned i = 2, e = Ops.size(); i < e; ++i)\n"
-     << "    if (Ops[i].getOpcode() != ISD::Constant)\n"
-     << "      AddToISelQueue(Ops[i]);\n"
      << "  std::vector<MVT::ValueType> VTs;\n"
      << "  VTs.push_back(MVT::Other);\n"
      << "  VTs.push_back(MVT::Flag);\n"
@@ -3585,7 +3582,6 @@
      << "  case ISD::TargetConstantPool:\n"
      << "  case ISD::TargetFrameIndex:\n"
      << "  case ISD::TargetJumpTable:\n"
-     << "  case ISD::TargetExternalSymbol:\n"
      << "  case ISD::TargetGlobalAddress: {\n"
      << "    return NULL;\n"
      << "  }\n"


Clean up function declarations

Clean up function declarations

Change-Id: Ie9081e6ed0840fad98f52f9755767788db77f406

--- uui/source/interactionhandler.cxx
+++ uui/source/interactionhandler.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */

+#include <sal/config.h>
+
+#include <boost/noncopyable.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -34,13 +37,11 @@
 class UUIInteractionHandler:
     public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo,
                                   com::sun::star::lang::XInitialization,
-                                  com::sun::star::task::XInteractionHandler2 >
+                                  com::sun::star::task::XInteractionHandler2 >,
+    private boost::noncopyable
 {
 private:
     UUIInteractionHelper * m_pImpl;
-
-    UUIInteractionHandler(UUIInteractionHandler &); // not implemented
-    void operator =(UUIInteractionHandler); // not implemented

 public:
     UUIInteractionHandler(com::sun::star::uno::Reference<


fix build problem on windows

fix build problem on windows

Change-Id: I0c965ac8abd25479ea97a95036f03c63daa106ae

--- vcl/source/gdi/pdfwriter_impl.cxx
+++ vcl/source/gdi/pdfwriter_impl.cxx
@@ -3748,7 +3748,7 @@
                 aUnicodes.clear();
                 for( std::vector< EmbedCode >::iterator str_it = enc_it->m_aEncVector.begin(); str_it != enc_it->m_aEncVector.end(); ++str_it )
                 {
-                    String aStr( str_it->m_aUnicode );
+                    rtl::OUString aStr( str_it->m_aUnicode );
                     aEncWidths[nEncoded] = pRef->GetTextWidth( aStr );
                     nEncodedCodes[nEncoded] = str_it->m_aUnicode;
                     nEncoding[nEncoded] = sal::static_int_cast<sal_uInt8>(nEncoded);
@@ -8260,7 +8260,7 @@
     //See qadevOOo/testdocs/StrikeThrough.odt for examples if you need
     //to tweak this

-    rtl::OUString aStrikeoutChar( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" );
+    rtl::OUString aStrikeoutChar = eStrikeout == STRIKEOUT_SLASH ? rtl::OUString("/") : rtl::OUString("X");
     String aStrikeout = aStrikeoutChar;
     while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth )
         aStrikeout.Append( aStrikeout );


Cancel the estimate of version when set loop_filter_level

--- decoder/vaapidecoder_vp8.cpp
+++ decoder/vaapidecoder_vp8.cpp
@@ -259,11 +259,9 @@
         picParam->loop_filter_deltas_mode[i] =
             m_frameHdr.multi_frame_data->mb_lf_adjust.mb_mode_delta[i];
     }
-    if ((picParam->pic_fields.bits.version == 0)
-        || (picParam->pic_fields.bits.version == 1)) {
-        picParam->pic_fields.bits.loop_filter_disable =
-            m_frameHdr.loop_filter_level == 0;
-    }
+
+    picParam->pic_fields.bits.loop_filter_disable =
+        m_frameHdr.loop_filter_level == 0;

     picParam->prob_skip_false = m_frameHdr.prob_skip_false;
     picParam->prob_intra = m_frameHdr.prob_intra;


Fix a problem copying stale reference when adding history modifications

--- renderdoc/driver/vulkan/vk_pixelhistory.cpp
+++ renderdoc/driver/vulkan/vk_pixelhistory.cpp
@@ -3947,9 +3947,13 @@
       eventPremods[mod.eventId] = mod.preMod;
     }

-    for(int32_t f = 1; f < frags; f++)
-    {
-      history.insert(h + 1, mod);
+    if(frags > 1)
+    {
+      PixelModification duplicate = mod;
+      for(int32_t f = 1; f < frags; f++)
+      {
+        history.insert(h + 1, duplicate);
+      }
     }
     for(int32_t f = 0; f < frags; f++)
       history[h + f].fragIndex = f;


Print the current storage directory to the console.

--- BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.cpp
+++ BlueBerry/Bundles/org.blueberry.osgi/src/internal/berryInternalPlatform.cpp
@@ -150,6 +150,7 @@
     dataLocation += QString::number(qHash(QCoreApplication::applicationDirPath())) + "/";
     m_UserPath.assign(dataLocation.toStdString());
   }
+  BERRY_INFO(m_ConsoleLog) << "Framework storage dir: " << m_UserPath.toString();

   Poco::File userFile(m_UserPath);


Add TODO comment for when liblangtag gets updated

Change-Id: Ic90a9e76c5b1ecbe58ff663ec8970841b7e33d2d


Update filter_bilateral_2das.hpp

Update filter_bilateral_2das.hpp

--- include/gl/filtering/filter_bilateral_2das.hpp
+++ include/gl/filtering/filter_bilateral_2das.hpp
@@ -304,14 +304,6 @@
         fbo->create(w, h, 1, false, imgOut->getTexture());
     }

-    if(imgTmp == NULL) {
-        float scale = fGLsm->getScale();
-        imgTmp = new ImageGL(    1,
-                                    int(imgIn[0]->widthf  * scale),
-                                    int(imgIn[0]->heightf * scale),
-                                    1, IMG_GPU, GL_TEXTURE_2D);
-    }
-
     ImageGL *edge, *base;

     if(imgIn.size() == 2) {


cleanup platform

cleanup platform

--- include/rectojump/game/components/platfrom.hpp
+++ include/rectojump/game/components/platfrom.hpp
@@ -14,19 +14,16 @@
 {
 	class platform : public entity_rect
 	{
-	protected:
-		void update(dur duration) override
-		{m_render_object.move(m_velocity * duration);}
-
-		void init() override
-		{ }
-
 	public:
 		platform(const sf::Vector2f& pos, const sf::Vector2f& size = {20.f, 20.f}) :
 			entity_rect{pos, size, {-0.3f, 0.f}}
 		{m_render_object.setOrigin(size.x / 2, size.y / 2);}

 		~platform() = default;
+
+	private:
+		void update(dur duration) override
+		{m_render_object.move(m_velocity * duration);}
 	};
 }


Move GenTests to new framework

Move GenTests to new framework

--- test/GenTests.cpp
+++ test/GenTests.cpp
@@ -27,49 +27,52 @@

 TEST_CASE("Gen") {
     SECTION("operator()") {
-        prop("passes the arguments to the functor",
-             [](const Random &random, int size) {
-                 bool called = false;
-                 Random passedRandom;
-                 int passedSize;
-                 Gen<int> gen([&](const Random &random, int size) {
-                     called = true;
-                     passedRandom = random;
-                     passedSize = size;
-                     return shrinkable::just(0);
-                 });
+        newprop(
+            "passes the arguments to the functor",
+            [](const Random &random, int size) {
+                bool called = false;
+                Random passedRandom;
+                int passedSize;
+                Gen<int> gen([&](const Random &random, int size) {
+                    called = true;
+                    passedRandom = random;
+                    passedSize = size;
+                    return shrinkable::just(0);
+                });

-                 gen(random, size);
-                 RC_ASSERT(called);
-                 RC_ASSERT(passedRandom == random);
-                 RC_ASSERT(passedSize == size);
-             });
+                gen(random, size);
+                RC_ASSERT(called);
+                RC_ASSERT(passedRandom == random);
+                RC_ASSERT(passedSize == size);
+            });

-        prop("returns the value returned by the functor",
-             [](const Random &random, int size, int x) {
-                 Gen<int> gen([=](const Random &random, int size) {
-                     return shrinkable::just(x);
-                 });
+        newprop(
+            "returns the value returned by the functor",
+            [](const Random &random, int size, int x) {
+                Gen<int> gen([=](const Random &random, int size) {
+                    return shrinkable::just(x);
+                });

-                 RC_ASSERT(gen(random, size) == shrinkable::just(x));
-             });
+                RC_ASSERT(gen(random, size) == shrinkable::just(x));
+            });

-        prop("if exception is thrown in generation function, shrinkable is"
-             " returned that rethrows the exception on call to value()",
-             [](const std::string &message) {
-                 Gen<int> gen([=](const Random &random, int size) -> Shrinkable<int> {
-                     throw GenerationFailure(message);
-                 });
+        newprop(
+            "if exception is thrown in generation function, shrinkable is"
+            " returned that rethrows the exception on call to value()",
+            [](const std::string &message) {
+                Gen<int> gen([=](const Random &random, int size) -> Shrinkable<int> {
+                    throw GenerationFailure(message);
+                });

-                 const auto shrinkable = gen(Random(), 0);
-                 try {
-                     shrinkable.value();
-                 } catch (const GenerationFailure &e) {
-                     RC_ASSERT(e.what() == message);
-                     RC_SUCCEED("Threw correct exception");
-                 }
-                 RC_FAIL("Did not throw correct exception");
-             });
+                const auto shrinkable = gen(Random(), 0);
+                try {
+                    shrinkable.value();
+                } catch (const GenerationFailure &e) {
+                    RC_ASSERT(e.what() == message);
+                    RC_SUCCEED("Threw correct exception");
+                }
+                RC_FAIL("Did not throw correct exception");
+            });
     }

     SECTION("operator*") {


Removed executable flag from HexFloat.cpp.


Save segments angular velocity for later use.

--- modules/body/src/inversedynamicsmatrix.cpp
+++ modules/body/src/inversedynamicsmatrix.cpp
@@ -170,7 +170,8 @@
           // -----------------------

           // - Pose of the segment
-          auto pose = math::to_pose(seg->pose());
+          auto spts = seg->pose();
+          auto pose = math::to_pose(spts);
           // - Rotation component of the pose in the Inertial Coordinate System (ICS)
           auto R = pose.block<9>(0);
           // - Tensor of inertia expressed in the ICS
@@ -236,6 +237,7 @@
           math::Vector Mp = Mdyn - Mwei - Mext;
           math::to_timesequence(Fp, jnt->name() + ".Force", rate, start, TimeSequence::Force, "N", jnt);
           math::to_timesequence(Mp, jnt->name() + ".Moment", rate, start, TimeSequence::Moment, "Nmm" , jnt);
+          math::to_timesequence(omega, spts->name() + ".Omega", rate, start, TimeSequence::Angle | TimeSequence::Velocity | TimeSequence::Reconstructed, "rad/s" , seg);

           // Set the next (reaction) distal joint variables
           Fd = Fp;


[ox/std] Remove template integer operators from OutStream

--- deps/ox/src/ox/std/trace.hpp
+++ deps/ox/src/ox/std/trace.hpp
@@ -102,20 +102,25 @@
 			oxTraceHook(m_msg.file, m_msg.line, m_msg.ch, m_msg.msg.c_str());
 		}

-		template<typename T>
-		constexpr OutStream &operator<<(const typename enable_if<is_integral_v<T>>::type &v) noexcept {
-			if (m_msg.msg.len()) {
-				m_msg.msg += m_delimiter;
-			}
-			if constexpr(T(-1) < 0) {
-				m_msg.msg += static_cast<int64_t>(v);
-			} else {
-				m_msg.msg += static_cast<uint64_t>(v);
-			}
-			return *this;
-		}
-
-		constexpr OutStream &operator<<(char *v) noexcept {
+		constexpr OutStream &operator<<(short v) noexcept;
+
+		constexpr OutStream &operator<<(int v) noexcept;
+
+		constexpr OutStream &operator<<(long v) noexcept;
+
+		constexpr OutStream &operator<<(long long v) noexcept;
+
+		constexpr OutStream &operator<<(unsigned char v) noexcept;
+
+		constexpr OutStream &operator<<(unsigned short v) noexcept;
+
+		constexpr OutStream &operator<<(unsigned int v) noexcept;
+
+		constexpr OutStream &operator<<(unsigned long v) noexcept;
+
+		constexpr OutStream &operator<<(unsigned long long v) noexcept;
+
+		constexpr OutStream &operator<<(char v) noexcept {
 			if (m_msg.msg.len()) {
 				m_msg.msg += m_delimiter;
 			}
@@ -129,40 +134,20 @@
 			}
 			m_msg.msg += v;
 			return *this;
+		}
+
+		template<std::size_t sz>
+		constexpr OutStream &operator<<(const BString<sz> &v) noexcept {
+			return operator<<(v.c_str());
 		}

 		template<std::size_t sz>
 		constexpr OutStream &operator<<(const BasicString<sz> &v) noexcept {
-			if (m_msg.msg.len()) {
-				m_msg.msg += m_delimiter;
-			}
-			m_msg.msg += v.c_str();
-			return *this;
-		}
-
-		template<std::size_t sz>
-		constexpr OutStream &operator<<(const BString<sz> &v) noexcept {
-			if (m_msg.msg.len()) {
-				m_msg.msg += m_delimiter;
-			}
-			m_msg.msg += v.c_str();
-			return *this;
-		}
-
-		constexpr OutStream &operator<<(char v) noexcept {
-			if (m_msg.msg.len()) {
-				m_msg.msg += m_delimiter;
-			}
-			m_msg.msg += v;
-			return *this;
+			return operator<<(v.c_str());
 		}

 		constexpr OutStream &operator<<(const Error &err) noexcept {
-			if (m_msg.msg.len()) {
-				m_msg.msg += m_delimiter;
-			}
-			m_msg.msg += static_cast<int64_t>(err);
-			return *this;
+			return appendSignedInt(static_cast<int64_t>(err));
 		}

 		/**
@@ -173,7 +158,60 @@
 			return *this;
 		}

+	private:
+		constexpr OutStream &appendSignedInt(int64_t v) noexcept {
+			if (m_msg.msg.len()) {
+				m_msg.msg += m_delimiter;
+			}
+			m_msg.msg += static_cast<int64_t>(v);
+			return *this;
+		}
+
+		constexpr OutStream &appendUnsignedInt(uint64_t v) noexcept {
+			if (m_msg.msg.len()) {
+				m_msg.msg += m_delimiter;
+			}
+			m_msg.msg += static_cast<int64_t>(v);
+			return *this;
+		}
+
 };
+
+constexpr OutStream &OutStream::operator<<(short v) noexcept {
+	return appendSignedInt(v);
+}
+
+constexpr OutStream &OutStream::operator<<(int v) noexcept {
+	return appendSignedInt(v);
+}
+
+constexpr OutStream &OutStream::operator<<(long v) noexcept {
+	return appendSignedInt(v);
+}
+
+constexpr OutStream &OutStream::operator<<(long long v) noexcept {
+	return appendSignedInt(v);
+}
+
+constexpr OutStream &OutStream::operator<<(unsigned char v) noexcept {
+	return appendUnsignedInt(v);
+}
+
+constexpr OutStream &OutStream::operator<<(unsigned short v) noexcept {
+	return appendUnsignedInt(v);
+}
+
+constexpr OutStream &OutStream::operator<<(unsigned int v) noexcept {
+	return appendUnsignedInt(v);
+}
+
+constexpr OutStream &OutStream::operator<<(unsigned long v) noexcept {
+	return appendUnsignedInt(v);
+}
+
+constexpr OutStream &OutStream::operator<<(unsigned long long v) noexcept {
+	return appendUnsignedInt(v);
+}

 class NullStream {